SELECT username,citytable.cityid FROM usertable,citytable WHERE usertable.cityid=citytable.cityid
在FROM子句中可用以下两种格式为表或视图指定别名: 表名 as 别名 表名 别名 例如上面语句可用表的别名格式表示为:
SELECT username,b.cityid FROM usertable a,citytable b WHERE a.cityid=b.cityid
SELECT不仅能从表或视图中检索数据,它还能够从其它查询语句所返回的结果集合中查询数据。
例如:
SELECT a.au_fname a.au_lname FROM authors a,titleauthor ta (SELECT title_id,title FROM titles WHERE ytd_sales
昔年°c
2024-10-22 16:03:24
select a."id" ,a."number" ,a."remark" ,a."num" ,a."weight" ,sum(nvl(b."killednum",0)) ,sum(nvl(b."killedweight",0)) from wc1 a ,wc2 b where a."number" = b."number"(+) group by a."id" ,a."number" ,a."remark" ,a."num" ,a."weight" order by a."id" ,a."number" ,a."remark" ,a."num" ,a."weight" ;
select a."id" ,a."number" ,a."remark" ,a."num" ,a."weight" ,sum(nvl(b."killednum",0)) ,sum(nvl(b."killedweight",0)) from wc1 a left join wc2 b on (a."number" = b."number") group by a."id" ,a."number" ,a."remark" ,a."num" ,a."weight" order by a."id" ,a."number" ,a."remark" ,a."num" ,a."weight" ;
玩贴吧的好菇凉
2024-10-22 12:54:26
贴个sql吧,给分吧 select a.number,remark,a.num,a.weight, nvl(b.killednum,0)killednum, nvl(b.killedweight,0)killedweight from wc1 a left join (select number,sum(killednum)killednum,sum(killedweight)killedweight from wc2 group by number)b on a.number=b.number