My tables..
users --------------------- pass | name | genre --------------------- 1 | Mike | pop 2 | Clark| rock favorites --------------------- id | pass | songs --------------------- 1 | 1 | blabla 2 | 1 | blaablaa 3 | 1 | blblbl 4 | 2 | lalala suggestions --------------------- id | pass | songs --------------------- 1 | 1 | brrbrrr 2 | 2 | lulala
My querys..
1. For Username and Genre
SELECT `name`, `genre` FROM `users` WHERE `name` = "Mike"query);
user_data->genre;
2. Count the favorite songs from ‘Mike’
SELECT COUNT(`songs`) AS "total_favorites" FROM `favorites` INNER JOIN `users` USING (pass) WHERE `name` = "Mike"query);
sug_dat = mysqli_fetch_object(
sug_dat->total_suggestions;
How can I combine these 3 queries in one? Is there a better way to write them?
Anonymous Asked question May 14, 2021
Recent Comments