我使用此查詢來從SQL Server 2008的數據:獲取從數據庫和顯示數據的DataGridView
select
g.godown_name, s.supplier_name, t.type_name,
r.bags_instock, b.lb_per_bag, t.rate
from
tbl_godown g, tbl_yarn_supplier s, tbl_yarn_type t,
tbl_yarn_receive r, tbl_godown_transaction gt, tbl_yarn_book b
where
r.book_id = b.book_id and
s.supplier_id = b.supplier_id and
t.type_id = b.type_id and
gt.godown_id = g.godown_id and
gt.receive_id = r.receive_id
結果是:
這裏是一些交易具有相同Godown
,Suppliar
,Tpe
& lbs_per_bag
1. 1 & 7
2. 2,3,4,5
3. 8,9,10,11
4. 12
5. 6
如果任何行具有相同Godown, Suppliar, Tpe & lbs_per_bag
他們不應該重複
結果應該是這樣的。
感謝
等待響應
看起來你需要一個簡單的GROUP BY子句 – Kane
可能是??? 通過google重新修改它。 –