Skip to content
Advertisement

Tag: inner-join

How to retrieve all grand parents at once

I have two simple tables in SQLITE3 (family bonds): “persons” (id, fname, lname) “relationships” (parent/child) I would like to get each grand children along with all their grand parents (from 1 to 4 of them depending on the grand child) so that 1 row result = Thanks to Caius Jard, I’ve been able to get each child and its grand

SQL INNER JOIN of sum distinct values

I have 3 tables called musics, singers and playlistInfos. I want to get Top 10 listened England musics.What kind of sql query help me? SELECT * FROM musics m INNER JOIN playlistInfo p ON p.musicID = m.id INNER JOIN singer a ON a.id = m.singerID GROUP BY p.musicID ORDER BY p.listened I try this one but I did not get

What is the issue in below sql query? [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 1 year ago. Improve this question I am beginner in sql. Anyone please tell me the problem of my customised query. Error Code: 1241. Operand should contain 1 column(s) Subscription table

mysql order by field row display even if empty

I’ve two tables( bom and bom_parts). Need to inner join and display stock_deduct,GRN_id,part_id fields. Table 1 (bom): Table 2 (bom_parts): MySql query: Query Result: Expected Result: Even if the part_id field is empty in this case 8, 6, I just want to display the part_id with the stock_deduct field as 1 in the result as mentioned below. Stock_deduct GRN_id part_id

Select from multiple tables with group and join

i have 4 tabels drinks, opskrifter, ingredients and stock the tables consist of drinks drink_id name beskriv glas image alcohol opskrifter drink_id ingredient_id quantity ingredients ingredient_id name stock ingredient_id name i want a query to select drinks that can be made in opskrifter of the ingredients in stock. i have this working, but it only returns drink_id. I want it

Update columns based on calculation

My table looks like this: I have a list of id’s connected to datestamps. I can manage to calculate the difference between their latest and first entry as follows: However, I am unsure how I can update my table to reflect these calculations. What I want is the following: Answer In MySQL, you can self-join: I would not necessarily recommend

Query slow in Web App, but fast in command line

I am need to retrieve records from two tables which are linked by a third. Session content doesn’t contain any information I need besides the keys to link the other two tables. I am currently using these joins: It only takes 50 ms in SQLite DB browser, but takes multiple seconds of buffering when I call the related API endpoint.

Advertisement