I’m trying to join two tables in MySQL, in one I have a set of IDs (of the type GTEX-14BMU-1526-SM-5TDE6) and a set of type’s of tissue(SMTS), I have to select the IDs for the tissue type ‘Blood’ (which is another column of the same table), and then I have to take only the first two strings (GTEX-14BMU) from the
Tag: inner-join
Select longest duration time (data type field) and client name SQL
I have these tables: CREATE TABLE Client ( client_id NUMBER(10) NOT NULL PRIMARY KEY, name VARCHAR(50) NOT NULL, address VARCHAR(50) NOT NULL ); CREATE TABLE Projects ( project_id …
Mysql subquery in where clause that returns comma separated value
I’m not really good at subqueries, here’s the sample tables that I have. table customers ===================== id | name | order_ids 1 | John | 1,2 table orders ===================== id | name 1 …
subquery shows more that one row group by
I am trying to get the data for the best 5 customers in a railway reservation system. To get that, I tried getting the max value by summing up their fare every time they make a reservation. Here is the code. this throws the error:[21000][1242] Subquery returns more than 1 row If I remove the group by from the subquery
Add information from two tables to second table
I’m a newbie in query building. I created two tables: product: productid | name | price order: id | productid | quantity | fullprice Can I automatically calculate fullprice (product.price * order….
SQLite: How to see people that aren’t my friend, but are friends with my friends
I have a database in DB Browser where I have two tables; So my question is, how do I make a query that Displays People that I’m not friends with, but my friends are friends with them. It’s so I can find new friends basically. Answer You can join multiple times:
How do I join two tables from a database in SQL?
I’m currently working on a project where we have to join two tables in SQL and then create a page to show the result of the two tables combined. This is what I have so far: SELECT * FROM ANIMAL …
What kind of join should I implement in order to receive the output I am trying to get?
NOTE: Just a practice problem.. NOT looking for free homework answers. The practice problem I have asks to report the number of flights by plane’s year in ascending order of plane’s year. This requires the joining of two tables, the flights table and planes table. I believe the SQL should be relatively simple, and I think the main issue with
How can I unite these two related queries?
I have this query to check if a person is a customer or have been: And I have this other query to get the locations: How can I unite them and show person location as a single row on the first query? Answer If I follow this correctly, you can use lateral joins: As commented already, your original first query
SELECT NOT IN with multiple columns in subquery
Regarding the statement below, sltrxid can exist as both ardoccrid and ardocdbid. I’m wanting to know how to include both in the NOT IN subquery. Answer I would recommend not exists: Note that I changed the table aliases to things that are more meaningful. I would strongly recommend prefixing the column names with the table they belong to, so the