Skip to content

Merge tables with unequal number of columns without returning duplicate rows

I have two tables, one is called original_table and the other is table_with_additional_column. table_with_additional_column is a subset of original_table but with an additional column called sequenceNr. I want to merge the two tables such that I can get all rows from original_table with sequenceNr set to NULL…

How to join a table with itself?

I want to ask how can I join the table with itself, using the same column twice, and giving each a different WHERE to sort out. I have an Employees table that contain Employee_name, job_id and manager_id. I want it to get the name of all the managers through the job_id on one column, and then all the employee…

How to count mention in one day [closed]

I am try to understant how to make a table that tells me in which specific day were written the most mentions about the persons in my table. SELECT person, COUNT(1) AS count_mentions, COUNT(…

Aggregation depends from value [closed]

I have a sample table ID Invoice_ID docType 1 100 email 2 100 sms 3 200 email 4 200 email 5 300 sms and I have to get results with only rows that have invoices with email and sms docType. For …