I have two tables: locations
and events
Each location can have multiple events. I am successfully doing a single query to grab all the location and matching events, however, the events are being returned as a merged data-set with all of the location
data. I need to somehow have each, and all, events, listed as sub-rows so I can properly process them later.
This query:
"select locations.*,events.* FROM locations,events WHERE locations.lid = events.lid AND locations.lid=1001"
Is returning merged data like:
data [array 1]
0: lid: "1001" // location info
name: "Johns Bar"
address1: "123 Main St"
...
...
eventID: "1000" // event info
eName: "Halloween Bash"
eDate: "2018-10-31"
...
...
Is it possible to grab the specific locations.lid
and all matching events.lid
and have the events
records listed as a subset of location
data.
Something that would return like:
data [array 1]
0: lid: "1001"
name: "Johns Bar"
address1: "123 Main St"
...
...
Events: [array 5]
0: lid: "1001"
eventID: "1000"
eName: "Halloween Bash"
eDate: "2018-10-31"
...
...
1: lid: "1001"
eventID: "1010"
eName: "Christmas Party"
eDate: "2018-12-17"
...
...
2: [lid: "1001",...]
3: [lid: "1001",...]
4: [lid: "1001",...]