Hi People,
I need some help with a SQL query... I have a number of tables in my database and I would like to be able to filter out just 1 list with certain information:
The 2 most important tables are:
Then a bit more complicated... I have a table for every user, named 'playlist_' + 'username'.
So my goal is:
Filter out a list based on gender, age, time and weather conditons with a combined count for every genre (tag1&tag2)
For example: Get list for Female users, aged 25 when it was raining (rain = 1)
Result:
Now I'm very new to SQL so I find this quite hard.. I hope to be able to do this in 1 query that I can send with PHP..
But any solutions to this are more than welcome.. Whoever can help me with this.. I owe you HUGE!
Thanks!
I need some help with a SQL query... I have a number of tables in my database and I would like to be able to filter out just 1 list with certain information:
The 2 most important tables are:
Code:
Table: users Columns: name, age, gender data example: Anaticula87, 22, m data example: Tweeke, 25, m data example: augustusmeisje, 40, f
Code:
Table: weather Columns: date, hour, temp, clouds, rain, snow data example: 20020101, 1, -1, 4, 0, 1 data example: 20020605, 4, 135, 2, 0, 0 data example: 20060213, 23, 46, 6, 1, 0
Code:
Table: playlist_anaticula87 Columns: UTSID, date, hour, artist, song, tag1, tag2 data example: 1183449088, 20070703, 2, The Chemical Brothers, The Big Jump, electronic, rock data example: 1183413662, 20070703, 3, The Chemical Brothers, Come Inside, electronic, rock data example: 1183182450, 20070630, 8, Incubus, When It Comes, rock, indie
So my goal is:
Filter out a list based on gender, age, time and weather conditons with a combined count for every genre (tag1&tag2)
For example: Get list for Female users, aged 25 when it was raining (rain = 1)
Result:
Code:
genre plays ------------------------------------------------- Rock 10230 Jazz 2765 RnB 89 Electronic 728 etc etc
Now I'm very new to SQL so I find this quite hard.. I hope to be able to do this in 1 query that I can send with PHP..
But any solutions to this are more than welcome.. Whoever can help me with this.. I owe you HUGE!
Thanks!
Comment