![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Any ideas how to achieve this type of strawberry query ? |
#3
| |||
| |||
|
|
On 2010-10-14 21:22, SM wrote: [...] Any ideas how to achieve this type of strawberry query ? Can you post a minimal set of tables (create statements) and some sample data (insert statements) that illustrate the problem? /Lennart |
#4
| |||
| |||
|
|
On Oct 15, 11:23 am, Lennart Jonsson<erik.lennart.jons... (AT) gmail (DOT) com wrote: On 2010-10-14 21:22, SM wrote: [...] Any ideas how to achieve this type of strawberry query ? Can you post a minimal set of tables (create statements) and some sample data (insert statements) that illustrate the problem? /Lennart here are all the tables involved in my query with some sample data. Also, the query and the results and expected results: http://www.rociojuradofanclub.com/to...lete/query.jpg |
#5
| |||
| |||
|
|
On 16-10-10 06:34, SM wrote: On Oct 15, 11:23 am, Lennart Jonsson<erik.lennart.jons... (AT) gmail (DOT) com wrote: On 2010-10-14 21:22, SM wrote: [...] Any ideas how to achieve this type of strawberry query ? Can you post a minimal set of tables (create statements) and some sample data (insert statements) that illustrate the problem? /Lennart here are all the tables involved in my query with some sample data. Also, the query and the results and expected results: http://www.rociojuradofanclub.com/to...lete/query.jpg you are using GROUP BY on track.track_id But you are not giving MySQL any direction on how to find the proper disc_id, thats why its finding an undefined one Somehow you have to sepcify that you want the disc_id (and artwork) that belong to the MIN(date(released) |
#6
| ||||||
| ||||||
|
|
here are all the tables involved in my query with some sample data. Also, the query and the results and expected results: http://www.rociojuradofanclub.com/to...lete/query.jpg |
|
track_id | disc_id | +----------+---------+ 80 | 1 | 92 | 1 | 252 | 1 | 332 | 1 | 382 | 1 | 466 | 1 | +----------+---------+ |
|
disc_id | +---------+ 1 | 2 | 3 | 4 | +---------+ |
|
track_id | +----------+ 550 | 551 | 552 | 553 | +----------+ |
|
album_id | +----------+ 1 | 1 | 2 | 2 | +----------+ |
|
album_id | +----------+ 8 | 9 | 10 | +----------+ |
#7
| |||
| |||
|
|
On 2010-10-16 06:34, SM wrote: [...] here are all the tables involved in my query with some sample data. Also, the query and the results and expected results: http://www.rociojuradofanclub.com/to...lete/query.jpg Is the data you provided correct? It appears as if the tracks don't belong to a disc, i.e. they have never appeared on a album: mysql> select track_id, disc_id from disc_track; +----------+---------+ | track_id | disc_id | +----------+---------+ | * * * 80 | * * * 1 | | * * * 92 | * * * 1 | | * * *252 | * * * 1 | | * * *332 | * * * 1 | | * * *382 | * * * 1 | | * * *466 | * * * 1 | +----------+---------+ 6 rows in set (0.00 sec) mysql> select disc_id from disc; +---------+ | disc_id | +---------+ | * * * 1 | | * * * 2 | | * * * 3 | | * * * 4 | +---------+ 4 rows in set (0.00 sec) mysql> select track_id from track; +----------+ | track_id | +----------+ | * * *550 | | * * *551 | | * * *552 | | * * *553 | +----------+ 4 rows in set (0.00 sec) Furthermore, the discs don't belong to any existing albums: mysql> select album_id from disc; +----------+ | album_id | +----------+ | * * * *1 | | * * * *1 | | * * * *2 | | * * * *2 | +----------+ 4 rows in set (0.00 sec) mysql> select album_id from album; +----------+ | album_id | +----------+ | * * * *8 | | * * * *9 | | * * * 10 | +----------+ 3 rows in set (0.00 sec) /Lennart |
#8
| |||
| |||
|
|
On 16-10-10 06:34, SM wrote: On Oct 15, 11:23 am, Lennart Jonsson<erik.lennart.jons... (AT) gmail (DOT) com wrote: On 2010-10-14 21:22, SM wrote: [...] Any ideas how to achieve this type of strawberry query ? Can you post a minimal set of tables (create statements) and some sample data (insert statements) that illustrate the problem? /Lennart here are all the tables involved in my query with some sample data. Also, the query and the results and expected results: http://www.rociojuradofanclub.com/to...lete/query.jpg you are using GROUP BY on track.track_id But you are not giving MySQL any direction on how to find the proper disc_id, thats why its finding an undefined one Somehow you have to sepcify that you want the disc_id (and artwork) that belong to the MIN(date(released) -- Luuk |
#9
| |||
| |||
|
|
On Oct 16, 3:41*am, Luuk <L... (AT) invalid (DOT) lan> wrote: On 16-10-10 06:34, SM wrote: On Oct 15, 11:23 am, Lennart Jonsson<erik.lennart.jons... (AT) gmail (DOT) com wrote: On 2010-10-14 21:22, SM wrote: [...] Any ideas how to achieve this type of strawberry query ? Can you post a minimal set of tables (create statements) and some sample data (insert statements) that illustrate the problem? /Lennart here are all the tables involved in my query with some sample data. Also, the query and the results and expected results: http://www.rociojuradofanclub.com/to...lete/query.jpg you are using GROUP BY on track.track_id But you are not giving MySQL any direction on how to find the proper disc_id, thats why its finding an undefined one Somehow you have to sepcify that you want the disc_id (and artwork) that belong to the MIN(date(released) -- Luuk how would i do that? i'm stuck here.... i cannot see clearly on how to achieve my goal.... i feel i have to do a strawberry type of query, but don't no how |
#10
| |||
| |||
|
|
On Oct 16, 3:41*am, Luuk <L... (AT) invalid (DOT) lan> wrote: On 16-10-10 06:34, SM wrote: On Oct 15, 11:23 am, Lennart Jonsson<erik.lennart.jons... (AT) gmail (DOT) com wrote: On 2010-10-14 21:22, SM wrote: [...] Any ideas how to achieve this type of strawberry query ? Can you post a minimal set of tables (create statements) and some sample data (insert statements) that illustrate the problem? /Lennart here are all the tables involved in my query with some sample data. Also, the query and the results and expected results: http://www.rociojuradofanclub.com/to...lete/query.jpg you are using GROUP BY on track.track_id But you are not giving MySQL any direction on how to find the proper disc_id, thats why its finding an undefined one Somehow you have to sepcify that you want the disc_id (and artwork) that belong to the MIN(date(released) -- Luuk how would i do that? i'm stuck here.... i cannot see clearly on how to achieve my goal.... i feel i have to do a strawberry type of query, but don't no how |
![]() |
| Thread Tools | |
| Display Modes | |
| |