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

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:

Selecting specified query from multiple select statement inside a single stored procedure

Good Day everyone! I’ve been searching everywhere on how to get a specified query using if-else statement inside a single stored procedure but still no luck on how to achieve those function. Here’s the T-Sql When exec command is called, it only return Command(s) completed successfully instead the value/table of the selected command. Since the @action is null, it should

Advertisement