Stanford Self Paced Course for SQL question: For all pairs of reviewers such that both reviewers gave a rating to the same movie, return the names of both reviewers. Eliminate duplicates, don’t pair reviewers with themselves, and include each pair only once. For each pair, return the names in the pair i…
SQL Server : sum and multiplies on 2 tables
I need help to SUM and MULTIPLIES on join 2 tables: tb1 tb2 In tb1, I need to sum QTY and multiples SKU with PRICE without repeating same SKU (21135208, 21035621): Current query: My result is: Expected result is: Answer I believe that you could filter out duplicates by using a subquery like SELECT DISTINCT &#…
how to show empty value for a int datatype in SQL?
how to show empty value for a int datatype in SQL? I have a case statement on an int datatype column to show empty for the values less than or equal to 0. case when [TotalValue]
Adding sheet name as column to query in Google Sheets
I have a Google Sheets document with my video game collection. Each console system has its own sheet, but I decided to consolidate all sheets into one new sheet as an overview using a query that looks something like this: This works fine, and I’m satisfied with it. However, my collection is quite large …
How to write a query with WHERE with two conditions
Right now I have: WHERE flag_1 NOT IN (“D”) AND flag_2 NOT IN (“D”) I have two sets of people working on the same data, and once one group is completed they will “flag” it D, but the report will …
SQL LIKE operator with aaa% having strange behavior
In my case I have patient table with few columns including patient’s firstname and lastname. Application using this table having patient search functionality with firstname and lastname. Having some …
Count child members from parent value
I have a table like conversations and conversation_timelines conversations table example | id | last_active | category_id | |——————————————-| | 1 | …
How to Filter multiple values for Where statement of SQL
Can any help on the below Query in the where statement in T-SQL? I have ID & Product fields in table,in where condition need to exclude the ID not in(’11’,’22’,’33’) only when for Product=’c’ …
Getting Distinct Id(FK) by the latest date in SQL Server
I’m currently working on a query where I need to distinct ID based on the latest date created. Here is my diagram | ID | ModelID | LocationId | DateCreated | |——+—————-…
MYSQL select and join multiple where AND clauses from the same table
There is a table of products, and a table for product tags. Trying to select all the products which have all the tags. So when a user refines their search, they only get the products with all the tags….