Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
April 13–15 - Dare to Unleash a New Professional You at Qlik Connect 2026: Register Now!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

IF Statement

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.

1 Solution

Accepted Solutions
Not applicable
Author

if(match(name,'24567','24568'), rowno()))

View solution in original post

5 Replies
Not applicable
Author

try this

for generate id corresponding to name then use recno() or rowno() like this

if(name<>' ',rowno()) as id

Not applicable
Author

Will I get all id's? If I need only the Id's corresponding to

'24567','24568' then what is the case?

Not applicable
Author

if(match(name,'24567','24568'), rowno()))

Not applicable
Author

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

Not applicable
Author

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