Skip to content

Update in DB2 using where exists instead of join

I’m trying to perform an update in DB2, which I started out trying with an inner join, but DB2 won’t allow that. I altered it to use a ‘where exists’ clause but now it’s telling me that main_discount in my set clause is not found (I’m assuming because it isn’t referen…

Trying to exclude certain users

New to SQL but I’m trying to find titles wherein the words “blue” and “black” are present. However, they cannot be from users who have ids of 1 and 5. This is what I did: However, when I add that id 1 and id 5 shouldn’t be in the query, it shows me something like this: Blog…

Oracle partitioning by range

I need to split the table into partitions, namely into three partitions according to the EVENT_TIME field, where the first partition is an interval of a week from today, the second last week and the third partition is history, where data that does not pass into the first two partitions are placed. In addition…

How to add ” and , for multiple ID in SQL Server

I am writing a SELECT query that has multiple id, and I have to manually add ”,” (e.g ’12L’,’22C’). I have around 2000 id in an Excel sheet. Is there any quicker way to add ”,” to all the ID? Answer Here is a conceptual example for you. It will work in SQL Serve…

Select data based on certain set frequency

I have the following table settings What I need is to select the entry based on whether it is allowed to trigger on date that or not. So lets say for example for the following entry id:xxx, trigger_metric: MONTHS, trigger_frequency:1 , trigger_start_date:’2021-09-01′ the row should be selected on …