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 2000 Forums
 SQL Server Development (2000)
 Comparisons with temporary columns

Author  Topic 

velvettiger
Posting Yak Master

115 Posts

Posted - 2008-04-23 : 18:46:15
Hi All,

I was just wondering if any one can tell me if it is possible to do a comparison on a column that is not in the database but a temporary one. I am using sql sever 2000.


E.g
[CODE]
SELECT CardNumber
,sum(DailyTransactionValue)TotalSpend
from Customer
where TotalSpend < 399
[/CODE]

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-04-23 : 18:53:27
SELECT CardNumber, TotalSpend
FROM (SELECT CardNumber,sum(DailyTransactionValue) AS TotalSpend from Customer group by CardNumber) t
WHERE TotalSpend < 399

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -