I am having a table with many columns (but posting only col1, col2, col3 here for simplified post): I want to fill null values of source _id with values from id. For example, source_id a5 row has null which has to replaced with id a1 values, subsequently, source_id a6 row having null to be replaced with a5 ro…
Tag: join
Single column from Multiple columns from join in SQL
I have a table output like this, which is a result of multiple table joins. I am trying to get a table like this. This is what i am doing currently doing. Not sure how to make the three columns combine to a single column. Answer If you have only one value per row — or if you just want
Join Multiple Table based on a condition
I have data where i need to join to different tables based on a condition, month. I am using proc sql. Currently I am using However, this is not working. Any help greatly appreciated. Answer You could do this in a single query, using conditional joins: Note that you should not have several tables to store the…
My MySQL select shows only 1 result instead of all that I chose
I have a problem with this mysql exercise, could someone help me so it displays all the records I want, because now it only takes a value from the column tytul and it gives the max, min and avg from …
SQL not returning values where null in another table
I’m trying to use the SQL join function to grab information from multiple tables. My issue is I can’t seem to get the desired result. select a.DRINKER, sum(C.PRICE) from DRINKERS a …
MySQL join another table value based on 2 different tables matching value? [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question The intended result is 12(price) and pic.png(profilepic). Is this possible to join jobs and …
Oracle Sql join two tables
I have a query joining two tables. RESULT_TABLE: ID, TEST_RESULT , TEST_STATUS EMAIL_TABLE: ID, EMAIL_TYPE, EMAIL_ADDRESS The RESULT_TABLE will typically have only one result per student. A …
SQL JOIN with WHERE condition when two rows’ values are the same and one row matches to two different rows
I have these tables: CREATE TABLE students( id int NOT NULL PRIMARY KEY, name VARCHAR(30) NOT NULL ); CREATE TABLE studentsActivities( studentId int NOT NULL, activity VARCHAR(30) NOT NULL, …
MySQL query – join 4 tables together, with 3 tables using group by one column from each
Here are examples of the 4 tables I’m working with. And I’m trying to get outputs with php foreach something like this … This is the query I’ve come for one table… Answer You can cross join the items table with all available dates in the three other tables, and then the aggregati…
On delete Error: SQL Error: ORA-00933: SQL command not properly ended
I’m trying to delete a student record from the database using the below query. But I face this error. Error report – SQL Error: ORA-00933: SQL command not properly ended 00933. 00000 – “SQL command not properly ended” Answer Give this a shot to delete student record for which the…