怎么查询这个结果?
有主表A和明细表B
A: 字段ID,TOTAL
B: 字段ID,GOODSiD,detailtotal
想查询的结果是主表关联明细表,总行书等于主表的行数,主表一行关联的明细有多行时候,只显示明细的第一行。谢谢
------解决方案--------------------
SELECT ID,TOTAL, GOODSID = SELECT TOP 1 GOODSID FROM B WHERE ID = A.ID, detailtotal = = SELECT TOP 1 detailtotal FROM B WHERE ID = A.ID