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…
What is wrong with this SQL statement in my Python code?
I’m working on a simple inventory app that will manage hardware and software inventory. Right now I’m just trying to simply enter in the data a user inputs into the text boxes into my database. The …
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():
Updating field value based on data across three separate tables
I have been trying to UPDATE the values of a field (IsException) from 0 to 1 in a table (g) based on corresponding data from a separate table (a) in two fields (name, date) when the combination of both appear in that separate smaller table. The problem I am running up against is that the ‘name’ fi…
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…
How to separate the full name that has comma in excel using php
I have a project that gets the name from excel and stores the value in the first name and last name. The problem is that in the excel file the name is stored (for example John, Constantine) how do I …
How to merge in SQL when the key variable is repeated in one of the tables?
I have a dataset with two tables. In the first, I have information about workers and in the second about companies. Each worker has an ‘id’ of the firm to which he belongs. I would like to create a …