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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 hi guys, question...

Author  Topic 

waterduck
Aged Yak Warrior

982 Posts

Posted - 2009-05-20 : 03:53:58
sorry to bother again...need help for the following query...>"<
select st_code
from (select t.st_code, (m.max_level<=(balance=sum(t.quantity)-sum(t.qtt_out)))as overmax from ord_trx t, st_mast m group by st_code)c

waterduck
Aged Yak Warrior

982 Posts

Posted - 2009-05-20 : 04:20:17
maybe i was not clear

select st_code, balance=sum(t.quantity)-sum(t.qtt_out)
from ord_trx t
group by st_code

select st_code, max_level
from st_mast

i wan to show out the result of (st_code, max_level in st_mast) which is lower than (st_code, balance in ord_trx)
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-05-20 : 05:01:11
[code]
select st_code, max_level
from st_mast as mast
join (select st_code, balance=sum(t.quantity)-sum(t.qtt_out)
from ord_trx t
group by st_code) ord
on ord.st_code = mast.st_code
where mast.max_level <= ord.balance
[/code]


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

waterduck
Aged Yak Warrior

982 Posts

Posted - 2009-05-20 : 21:20:20
thx alot webby
Go to Top of Page
   

- Advertisement -