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 2012 Forums
 Transact-SQL (2012)
 CASE COUNT

Author  Topic 

Blessed1978
Yak Posting Veteran

97 Posts

Posted - 2014-12-18 : 16:17:00

I get an error on the below querry when i want to check if my address count is greater than 1 then do something else

CASE WHEN COUNT(a.line1) >1 THEN (select top 1 a.line1 from address a where a.adr_key = c.cst_key and
a.change_date is not null and a.line1 not in (select top 1 adrbill.line1 from co_customer)) ELSE adrbill.line1 END

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-12-18 : 16:20:29
please post the whole query and the error messages you get. FWIW that CASE expression looks really nasty but I'd need to see it in context.
Go to Top of Page

sz1
Aged Yak Warrior

555 Posts

Posted - 2014-12-24 : 05:55:09
Im with gbritton looks incomplete where your join for the c. for a start.

We are the creators of our own reality!
Go to Top of Page
   

- Advertisement -