Need help to write sql query using exists command with case statements
if the name =Dnoeth then Y should be dispalyed and come out of the loop
I'm not sure what you want to achieve. If you want to get rid of 1-Peter as duplicate key ID=1 or something else ? What is the source of reference for string "Dnoeth" ? I doubt you want to mark with Output="Y" just this single string ? (if yes : select .... , case when NAME = 'Dnoeth' then 'Y' else 'N' end as Output). Why you are talking about a "loop" ? (I assume because you are trying to convert some VBA makro using a loop code to a SQL statement ?). We usually don't use the term "loop" in SQLs (of course database is using loops when performing sql statement) (of course except stored procedures or recursive sqls).
sorry for late reply ikilma met with some accident and could not reply soon.
i hope that is specality of exists command,if the condition exists it will satisfy the condition and come out for the loop could you help me on this