Welcome Guest, Not a member yet? Register   Sign In
Query help
#1

[eluser]JamieBarton[/eluser]
Hey guys

As you're probably aware, I'm not that hot on querying, and after so many times of probably asking SQL related questions, you're probably wondering why I still don't 'get it'... However.. Here we go with another question haha.

I'd like to list a bunch of events...

The events must show ...

Title, Date and time, and the location of the event (This is grabbed through a city_id field), which relates to a city in the cities table.

Also in the events which are listed must show artists attending that event, (well, at a max 3 artists). These are gathered from the artistsAttending, and that table looks like..

artistsAttending:

artistsAttending_id / artist_id / event_id

I'd like to show the names of the artists, so how would I then JOIN to the artists table...

Lastly, these events will be queried for a Saved Events page...

These are stored in a savedEvents table... like:

savedEvents_id / user_id / event_id



ANy help on how to do this would be greatly appreciated....



Regards,
Jamie Smile
#2

[eluser]Odogg[/eluser]
Off the top of my head it will be something like.

select a.*, b.*, c.* from events a join artists b on a.eventID=b.eventID join artistName c on b.artistID=c.artistID where a.cityID='citySelectedID' order by Date (or what ever you wanted to order by.




Theme © iAndrew 2016 - Forum software by © MyBB