Context: mysql
I have two tables.
"Person" Table with three fields
PK: person_id,
first_name,
last_name.
"Message" table
PK: message_id,
FK: receiver_id,
FK: sender_id,
message_body
The receiver_id and sender_id in the message table refer to
the person_id in the person table.
I want to write a query, using where clause (only), with the following format:
I need the query to list the first_name and last_name of both sender and receiver.
Your assistance is appreciated.
I have two tables.
"Person" Table with three fields
PK: person_id,
first_name,
last_name.
"Message" table
PK: message_id,
FK: receiver_id,
FK: sender_id,
message_body
The receiver_id and sender_id in the message table refer to
the person_id in the person table.
I want to write a query, using where clause (only), with the following format:
Code:
SELECT first_name AS "Sender's First Name", last_name AS "Sender's Last Name" first_name AS "Receiver's First Name", last_name AS "Receiver's Last Name" FROM message, person WHERE message.sender_id = 1 AND message.sender_id = person.person_id ???????;
Your assistance is appreciated.