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)
 Need Query Plz

Author  Topic 

Abhikerry
Starting Member

4 Posts

Posted - 2009-06-17 : 15:08:38
I have two tables names AmountTable and TotalAMount table

AmountTable have columns sales, amountid,so on.......
Totalmount tbale have coloumns PIF,amountid,so on....


I nedd AmountTable /Totalmount values by joining thses two coloumns by using amountidis the common coloumn,


please send me the query

Thanks..

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2009-06-17 : 15:21:25
try this:

select isNull(at.[sales] / nullif(ta.PIF,0), 0) as [result]
from AmountTable as at
inner join TotalAMount as ta
on ta.amountid = at.amountid


Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -