Skip to content

SELECT COUNT from two tables is not working

I have two tables – first table is “projects”: p_id p_name 1 test1 2 test2 3 test2 4 test3 p_name is not unique The second table is “employee”: e_id jan feb mar apr may 1 2 2 3 3 4 2 1 1 3 3 2 3 1 3 2 3 3 4 4 3 2 3 4 I’d like

How to unite two SQL statements when referencing a few tables

I have the following TABLES and RECORDS. I need to answer the following query: Find the names of all the teachers that Ann Chin has, along with all her classes and midterm grades from each. So far, I have tried many SELECT combinations, but I keep getting duplicate values and returns. This is the closest I ha…

Conditional Aggregation query not giving correct output

I am trying to find average using conditional aggregation. I have 2 tables in SQL as below RentalExtension Table: RentalItemsID ExtensionDate ExtensionBy_UserID 7 2020-07-27 10 1 2020-07-28 7 The user table contains attributes as listed in select query When I run the query above I get Extension Rate for UserI…

How to group by two columns in mysql

I am building a chat website, I have a table that contains the following columns, from_id, to_id, messages. The from_id is the id of the user that the chat is from and the to_id is the id of the user the chat is sent to. Now I want to get all the chats but I also want to group it

SQL: How to select rows for two conditions?

Hey I have frame which looks like this I want to get one airport from every state which is closest to the south. Answer I am not sure what you mean by “closest to the south”. I will interpret it as the minimum latitude. If so, you can use row_number():

Add a row number to a microsoft access query

I have a SELECT DISTINCT query result to which I would like to add a row number to each row. I have tried ROW_NUMBER OVER… syntax, but after a lot of research I think that it turns out this is not supported in ACCESS. I have a table of information called – SYNC002_ACCESS and the query below: Which…