Reputation: 83
I need to join two tables(Child and Parent/Carer) in one, listing first_name, last_name of Child in one column, and pc_title, pc_fname, pc_lname, pc_phone in another column. What would be the query? Thank you.
Upvotes: 0
Views: 1655
Reputation: 9926
Without more details of your schema and specific desired results, this is just a rough guestimate
SELECT
CONCAT_WS(' ',c.first_name,c.last_name) AS child_name,
CONCAT_WS(' ',pc.pc_title, pc.pc_fname, pc.pc_lname, pc.pc_phone) AS parent_carer_details
FROM Child c INNER JOIN Parent_Carer pc ON c.pc_id=pc.pc_id
ORDER BY child_fname
That assumes that pc_id
is a field in the child table, and the primary/identifying key in the parent/carer table is also namedpc_id
.
If you supply the schema, the edges can easily be roughed out.
Upvotes: 1