Aim: Select all distinct values from three different columns, each located in a different table: [QueryA].Att1, [QueryB].Att2, [QueryC].[Att C]. Return all selected values in a single column in a 4th …
Tag: sql
SQL Server – Remove some numbers in a string contains numbers
I have a column contains string with numbers formatted as comma delimiter. I want to write an update query to update those numbers in the column based on the numbers to be removed that provided, but I …
How can I count unique clicks across jobs for each category
I store link performance attributed to different categories in a sent table like this… CREATE TABLE sent ( customer_id INT, jobId INT, category VARCHAR(100), timestamp DATETIME DEFAULT …
How to left join more than 3 tables [closed]
I’m struggling as a junior to create a view based on 5 tables: Country, Business, SubBusiness, Role and Type CREATE VIEW my_view AS SELECT DISTINCT `a`.`country`, `b`.`business`, `c`.`sub_business`, `…
SQL window function with date filter
Looking to do a LAG/LAST_VALUE/MAGIC window function on a table which somehow needs to include a date filter (as in how far back it should go). I’m trying to get the value as of 7 days ago onto every …
Another instance of Derby may have already booted the database
I’m connecting to a Derby DB through the command line. After connecting, by mistake got out from IJ in a unproper way. Now when I try to connect again this message is shown: I think this is happening …
How to select user ID who has saved the most products and the list of products he has saved
I am trying to query the user ID who has saved the most products and the list of products he has saved +—————-+———+ | Saved products | user_id | +—————-+———+ | A …
Concat based on sequence number
I’m trying to concat a text field based on a separate field and sequence number. For this example let’s say the fields I have are employee ID, Sequence#, and Comments. The comments field is limited …
How to order by column minus first character in a select distinct statement
I need to organize a query based on a column in sequential order in a select distinct statement. The select distinct statement concatenates a character onto the front of a number (i.e “S1”, “S2″…”…
Is there a way to generate an automated email if no changes have been made to a column for a specific period of time?
I’m trying to generate an automated email if no change occurs to a specific column on my database. I have a “Description” column on my database with different entries but the one that i want to …