SQL语句荟萃

1.查出多条数据只取第一条:select * from (select * from user) where rownum=1;

2.嵌套,子嵌套用到父sql的结果:

1 select a.id id,
2           (select b.name from B b where b.id = a.id and rownum = 1) name
3 from A a

 

posted @ 2017-09-29 16:58  海玲海玲  阅读(125)  评论(0编辑  收藏  举报