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
 General SQL Server Forums
 New to SQL Server Programming
 quick one

Author  Topic 

stumbling
Posting Yak Master

104 Posts

Posted - 2007-08-10 : 10:15:06
Hi All

What am i doing wrong with this im tired and for the life of me it wont work
Cheers
Phil

if
(Select sum(Unitprice*qtysold) from #DataExport_tmp where recordtype = 'L'group by transref )<> select Totalcost from #DataExport_tmp where recordtype = 'T'
BEGIN
PRINT 'no good'
end

ashley.sql
Constraint Violating Yak Guru

299 Posts

Posted - 2007-08-10 : 11:14:15
can u post some sample data along with scripts for tables

Ashley Rhodes
Go to Top of Page

ashley.sql
Constraint Violating Yak Guru

299 Posts

Posted - 2007-08-10 : 11:17:03
TRY THIS


if
(Select sum(Unitprice*qtysold) from #DataExport_tmp
where recordtype = 'L'group by transref )<>
(select Totalcost from #DataExport_tmp where recordtype = 'T')
BEGIN
PRINT 'no good'
end


Ashley Rhodes
Go to Top of Page

stumbling
Posting Yak Master

104 Posts

Posted - 2007-08-10 : 11:56:03
quote:
Originally posted by ashley.sql

TRY THIS


if
(Select sum(Unitprice*qtysold) from #DataExport_tmp
where recordtype = 'L'group by transref )<>
(select Totalcost from #DataExport_tmp where recordtype = 'T')
BEGIN
PRINT 'no good'
end


Ashley Rhodes



Thanks for that Cheers
Phil
Must go to bed ow so tired now. LOL
Go to Top of Page
   

- Advertisement -