I have a table called Users that stores generic user information (user id, first, last name, email id, phone number, is active, etc.). User Id is primary key.
I have a second table that stores the user's condo unit numbers (one to many relationship). One user can have one or more condos. User Id is secondary key.
UserID UnitNumber
1 2A
1 2B
2 8H
I have a third table that stores the user's parking spot numbers (one to many relationship). One user can have zero or more parking spots. User Id is secondary key.
UserID ParkingSpot
1 104
1 105
1 208
2 205
2 206
How can I write a query that will return the user information plus the condo unit numbers and parking spot numbers for each user?
What I am looking to obtain is something like this:
UserID FirstName LastName Email Phone Units ParkingSpots
1 John Smith john@xyz.com 123-456-7890 2A, 2B 104, 105, 208
2 Mike Allen mike@xyz.com 456-789-0123 8H 205, 206
Thanks!