Forum Discussion
sabrinekalbousi
5 years agoRegular Visitor
Update a column in SQL based on field frequency
Hello SQL query team , I need to create a dimension in my database ( to create later a report in Power BI) and I am struggling with the stored procedure. In fact, I need to have the following ta...
- 5 years ago
That's not a valid SQL syntax
UPDATE table
SET field= CASE WHEN THEN ELSE END
WHERE <filter condition>
The FROM statement is only needed when you update one table's columns from another related table's content.
mohdmohideen200
1 year agoHelper I
I'm guessing you added "_Perfect" to indicate you thought the past perfect should be used.
The query first calculates the category frequencies and stores them in a temporary table. Then, it uses this temporary table to update the products table. Finally, to ensure a clean environment, the temporary table is dropped. This temporary table approach can sometimes be faster than the subquery method, particularly for very large tables.