Skip to content
Advertisement

Tag: if-statement

Print within the SQL Server Select query based on the condition

I have this query from the link here which works fine, only that I am adding include FK constraints ‘ON Delete/ Update cascade’ if delete/update_referential_action is 1. I am unable to achieve the desired result. Any help appreciated. Answer Ms Sql 2016 dose not support if statement in middle of query. You must use case statement instead of it. you

Add new column with Boolean in PL/SQL

I’m learning PL/SQL right now and I have a doubt. I have created the following table called tbProducts: And I have inserted some values so the table is like this: Now what I’m looking for is a boolean variable that can be called bUpdate that returns FALSE if today’s date (26-AUG-2021) is greater than dLastDate and returns TRUE if it’s

MySQL table update after multi field check

Hi I have two table one like this one: table1 and one like this: table2 I would like to update all the fields on the table2 column “newID” based on this rules: if (table2.ID = table1.ID_actual or table2.ID=table1.ID_old) then table2.newID = table1.newID How can I resolve this problem ? Answer You need a join of the 2 tables in the

MySQL: Updating multiple columns using if else

I need help to set a mySQL update query for my little project like below: In my table, there is a column REFERENCE which contains varchar like where the character before the symbol ‘_’ determines certain values for other columns like stated above. I am still fairly new to mySQL, so appreciates any help! Answer You can use case expressions:

Advertisement