Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have below query
select a.id
,a.name
,b.id
,b.name
from databasenew.Table1(nolock)a
left join
databaseold.Table1(nolock)b
on a. id=b. id
where a.name in ('24567','24568')
order by a.id
I need to write IF statement to generate the id's corresponding to those names. Can anyone help in this.
Thanks.
if(match(name,'24567','24568'), rowno()))
try this
for generate id corresponding to name then use recno() or rowno() like this
if(name<>' ',rowno()) as id
Will I get all id's? If I need only the Id's corresponding to
'24567','24568' then what is the case?
if(match(name,'24567','24568'), rowno()))
if(name=pick(match(name,'24567','24568'),'24567','24568'),rowno()) as id
or try this
if(name=pick(match(name,'24567','24568'),'24567','24568'),recno()) as id
Hi,
Thanks, it's working.
How can I change this IF statement as I need to get integer for eg: 23145 instead of 'Others'
IF(len(trim(name))=0 OR ISNULL(name)=-1,'Others',name) AS name_New
Please help