and more in a single search tool across platforms. Read the announcement here. |
04/05/2023 08:18 AM
Hello team,
Working on a preprocess query where we're storing a flag value in a customproperty, based on employee type/ If emptype is Industrial, then cp40 should be 2, else it should be 1.
For this I've used the queries:
"UPDATE NEWUSERDATA NU LEFT JOIN CURRENTUSERS SET NEWUSERDATA.CUSTOMPROPERTY40 = case when NEWUSERDATA.EMPLOYEETYPE LIKE '%Industrial%' then '2' else '1' end where CURRENTUSERS.USERNAME=NEWUSERDATA.USERNAME"
"UPDATE NEWUSERDATA NU LEFT JOIN CURRENTUSERS SET NEWUSERDATA.CUSTOMPROPERTY40 = case when NEWUSERDATA.EMPLOYEETYPE LIKE '%Industrial%' then '2' else '1' end"
and
"UPDATE NEWUSERDATA NU LEFT JOIN CURRENTUSERS SET NEWUSERDATA.CUSTOMPROPERTY40 = case when NEWUSERDATA.EMPLOYEETYPE LIKE '%Industrial%' then 2 else 1 end"
In all, I am getting error:
You have an error in your SQL syntax; check
the manual that corresponds to your MySQL server
version for the right syntax to use near 'SET
TEMPNEWUSERS_242611.CUSTOMPROPERTY40 = case when
TEMPNEWUSERS_242611.EMPLOYE' at line 1
Our version is 23.3. Does anyone have any alternate way of writing this or any input on what the issue is?
Thanks,
Seemran Biswal
04/05/2023 12:30 PM
Can you try with this query
UPDATE NEWUSERDATA SET NEWUSERDATA.CUSTOMPROPERTY40 = case when NEWUSERDATA.EMPLOYEETYPE LIKE '%Industrial%' then '2' else '1' end
04/05/2023 06:45 PM
Hi,
Can you please try below?
UPDATE NEWUSERDATA u SET CUSTOMPROPERTY40 = (case when u.EMPLOYEETYPE LIKE '%Industrial%' then '2' else '1' end)
Thanks
Devang