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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
pauldamen
Partner - Creator II
Partner - Creator II

Where clause in SQL not working

Hi,

I have a SQL load which i want to incorporate a where clause in. I have done it before but I can't seem to get it working now and I am not doing anything else.

My script looks like this:

SQL SELECT
ActualEnd,
ActualStart,
`lut_Event_Id` as EventID,
`lut_SponsorRevenue` as SponsorRevenue,
Name as CampaignName,
`OwnerId_Name` as UserName,
Id as CampaignID
ProposedEnd,
ProposedStart,
StateCode as CampaignStatus,
TypeCode as CampaignType
FROM CData.Campaign
where StateCode = 'Active';

Any idea what is going wrong?

Regards, Paul

1 Solution

Accepted Solutions
pauldamen
Partner - Creator II
Partner - Creator II
Author

Guys, I found it.

Your  post got me thinking Vikas so I tried, Statuscode = '1' instead of Active and this worked! For some strange reason all the previews show the name but somewhere under water in the database it is called 0 and 1

Regards ,Paul

View solution in original post

9 Replies
swuehl
MVP
MVP

What do you mean with 'not working'?

Do you get an error message?

Or do you see more records with other StateCode than 'Active'?

What if you run only this code in a script (no further LOADs, with possible autoconcatenated records to your table)?

richard_chilvers
Specialist
Specialist

Paul

Does it fail (with error message) or just give unexpected results ?

jonathandienst
Partner - Champion III
Partner - Champion III

There is no comma after "Id as CampaignID"

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
pauldamen
Partner - Creator II
Partner - Creator II
Author

Sorry guys forgot to attach the error screenshots (error is to long so I made 2 screenshots to capture the full sentence)

Find attached. I have never encountered that error beforeerror1.PNGerror2.PNG

vikasmahajan

check with StateCode filed whether it is  'Active' , I think it should have some different values


Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
pauldamen
Partner - Creator II
Partner - Creator II
Author

I checked but in the preview it gives me the exact values.

Regards, Paul

error3.PNG

pauldamen
Partner - Creator II
Partner - Creator II
Author

Guys, I found it.

Your  post got me thinking Vikas so I tried, Statuscode = '1' instead of Active and this worked! For some strange reason all the previews show the name but somewhere under water in the database it is called 0 and 1

Regards ,Paul

swuehl
MVP
MVP

I think there is some kind of enum used for that field.

vikasmahajan

you can mark correct ans  to those post who have given you correct feedback.

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.