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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Update in Qlik script

Hi All,

I want to add one column in my existing created table  called 'state' column name should be "sid" and after that i have to write below sql update statement in qlik.

UPDATE a  set sid = 1    FROM state a where a.statename='MAH'

UPDATE a  set sid = 1    FROM state a where a.statename='MAH1'

UPDATE a  set sid = 2    FROM state a where a.statename='KAS'                                                       

UPDATE a  set sid = 3    FROM state a where a.statename='TAM'                                       

UPDATE a  set sid = 4    FROM state a where a.statename='PAN'               

UPDATE a  set sid = 5    FROM state a where a.statename='HP'

UPDATE a  set sid = 6    FROM state a where a.statename='UP'

UPDATE a  set sid = 6    FROM state a where a.statename='MP'

UPDATE a  set sid = 7    FROM state a where a.statename='RJ'

UPDATE a  set sid = 9    FROM state a where a.statename='OS'                                                         

UPDATE a  set sid = 11   FROM state a where a.statename='GOA'

UPDATE a  set sid = 12   FROM state a where a.statename='JP'

UPDATE a  set sid = 12   FROM state a where a.statename='JP1'

UPDATE a  set sid = 14   FROM state a where a.statename='SP'

UPDATE a  set sid = 15   FROM state a where a.statename='PD'

UPDATE a  set sid = 44   FROM state a where a.statename='PQ'

How can we do that.

Thanks

Labels (1)
10 Replies
vinieme12
Champion III
Champion III

For Example, the below is your Fact:

FACT

statename,

Field1

field2,

Field3,

From XXXXX;

Left Join

LOAD * INLINE [

statename,sid

MAH,1

MAH1,1

KAS,2

.....and so on list statenames and sid for those states which you want to assign numeric id's

];

This should resolve your problem

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.