SkyRanger Posted October 6, 2020 Share Posted October 6, 2020 Not sure why I am thinking this is so hard but keep getting an error in my code (Visual Basic) Situation: database = xmas table = songlist column 1 = title column 2 = artist I have 2 dropdown boxes being populated box 1 is the title box 2 is the artist When person choses song in box 1 it populates the artist name in box 2 (this part is working) . The problem I am running in to is I need to group all of the songs that are the same to be listed in box 1 but not group the names in box 2 I have(had) select * from songlist group by title Quote Link to comment Share on other sites More sharing options...
requinix Posted October 6, 2020 Share Posted October 6, 2020 1 hour ago, SkyRanger said: The problem I am running in to is I need to group all of the songs that are the same to be listed in box 1 but not group the names in box 2 What do you mean by "group"? The normal way this "I have 2 dropdown boxes being populated" problem goes is that you get a list of all titles and put that in the first one, then get a list of all artists that match the title selected in the first. Neither have anything to do with grouping. Quote Link to comment Share on other sites More sharing options...
Barand Posted October 6, 2020 Share Posted October 6, 2020 If I am understanding the question correctly, the query to populate Box 1 is SELECT DISTINCT title FROM xmas ORDER BY title; On your page, use an onchange handler to send an AJAX request which sends the title then receives the results of this second query to populate Box 2 SELECT artist FROM xmas WHERE title = ? Quote Link to comment Share on other sites More sharing options...
SkyRanger Posted October 6, 2020 Author Share Posted October 6, 2020 Thanks Barand. Yeah I don't think I explained that correctly. table is called songlist with multiple columns but only pulling info from 2 of them . title = song title and artist = song artist. I have multiple song titles with the same name. ie: Jingle Bells sung by different artist. Right now I have it showing all the songs in the list without grouping them together. So once the person picks on a song title in the first box a list of artists shows in the second box who did that song. Quote Link to comment Share on other sites More sharing options...
Barand Posted October 6, 2020 Share Posted October 6, 2020 That's what I thought. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.