Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
usafelix
Posting Yak Master
165 Posts |
Posted - 2015-02-10 : 23:09:36
|
my expect result is below , pls give one query for below :=sales headertrx_no = S0001trx_no = S0002anyone can help give a simple query ?Sales Detailtrx_no = s0001item_1 $100item_2 $200item_3 $300trx_no = s0002item 4 $1000item 5 $1000I want the result is below and no duplicate trx no must :---trx_no = s0001 $600trx_no = s0002 $2000 |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2015-02-11 : 05:07:30
|
select h.trx_no, dt.itemsumfrom header as hleft join (select trx_no, sum(item) as itemsum from deatail as d group by trx_no) as dton h.trx_no = dt.trx_no Too old to Rock'n'Roll too young to die. |
|
|
|
|
|