这样么: select b,(select a from tableA) a from tableB;
LS的写法是错的...如果子查询是列,用join.
不好意思,还有一问:a,b两表,a表(商品详情)的主键ddd(商品代码)是b表(销售情况)列ccc(商品代码)的外键,我想要的查询结果是显示对应a表ddd,b表ccc中销售时间最近的一条记录,这样写对吗? select a.ddd, (select max(b.销售时间) from b) from a,b where a.ddd=b.ccc请指教!!
如果子查询返回一行是可以的: select code,(select week from t2 where rownum<2) b from t1;
明显是错的。 select a.id,max(b.value) from a,b where a.id=b.id group by a.id;
select a.ddd, max(b.销售时间) from a,b where a.ddd=b.ccc group by a.ddd全部商品的最近一条记录.
对不起,我需要显示的还有a表中的其他字段,oracle提示非有效的group by 分组,怎么回事?
select a.id,a.others,max(b.value) from a,b where a.id=b.id group by a.id,a.others;
select b,(select a from tableA) a from tableB;
select a.ddd, (select max(b.销售时间) from b) from a,b where a.ddd=b.ccc请指教!!
select code,(select week from t2 where rownum<2) b from t1;
select a.id,max(b.value) from a,b
where a.id=b.id
group by a.id;
select a.ddd, max(b.销售时间)
from a,b
where a.ddd=b.ccc
group by a.ddd全部商品的最近一条记录.
where a.id=b.id
group by a.id,a.others;