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.
Author |
Topic |
oracle_corrgi
Yak Posting Veteran
98 Posts |
Posted - 2006-09-05 : 00:06:55
|
hipls give me eg for case function with row counteg: if the row count is >1 then HIGH <1 or zero low---these r table and column for refernce--DECLARE @rc tinyint ,@var varchar(50)set @var = (SELECT emd.tpa_idfrom dbo.EMPLOYER_DIVISION AS ED,EMPLOYEE_MISC_DATA AS EMDwhere emd.tpa_id=ed.tpa_idandemd.empe_key=ed.division_key)thanxsindia-bangaloredatabase |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-09-05 : 01:02:09
|
I think you finally will get a correct answer if you at least tell us what is wrong with the previous suggestions we have made herehttp://www.sqlteam.com/forums/topic.asp?TOPIC_ID=71475http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=71485Here is another solutionselect d.tpa_id, case when d.it > 1 then 'High' else 'Low' end as statusfrom ( SELECT emd.tpa_id, count(*) it from dbo.EMPLOYER_DIVISION AS ED inner join EMPLOYEE_MISC_DATA AS EMD on emd.tpa_id=ed.tpa_id and emd.empe_key=ed.division_key) group by emd.tpa_id ) d Peter LarssonHelsingborg, Sweden |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-09-06 : 07:05:03
|
Well, at least you could have the decency to tell us what is wrong and even when it worked for you.Peter LarssonHelsingborg, Sweden |
 |
|
|
|
|