I have 3 tables, something like this (simplified ofc here):
- Users
- Information
- contacts
- contact_id
- user_id
- contact_data li>
users have a one-to-one relationship with information, although information does not always have an associated record.
users have a one-to-many relationship with contacts, although contacts do not always have related records.
I know that I can capture the proper “user information” + “information” with a left connection, is there a way to get all the data I want right away?
For example, one returned record could be:
user_id: 5
user_name: tom
info_id: 1
rate: 25.00
contact_id: 7
contact_data: 555-1212
contact_id: 8
contact_data: 555-1315
contact_id: 9
contact_data: 555-5511
Is this possible with a single request? Or should I use several?
source
share