0

can't solve a homework problem for computer class. Any clues?: Given two tables, USERS and LOG, where USERID is a primary key in USERS and a foreign key in LOG, write a SQL statement that will return LOG records (all fields) with corresponding USERIDs in USERS. The report should include the LAST_NAME field from USERS and be sorted by user's last name, i.e., USERS.LAST_NAME

Thanks in advance for any help!

3
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by dickersonka
0

this is what i have so far:

SELECT * FROM LOG ORDER BY LAST_NAME DEC

...but I don't know how to incorporate the USERS table into it... confused

0

this is what i have so far:

SELECT * FROM LOG ORDER BY LAST_NAME DEC

...but I don't know how to incorporate the USERS table into it... confused

This is incorrect answer to your homework , you have to use thing like where userid='userid' ,etc .

0

let me give a sample schema and maybe that will help you understand

users
USER_ID
FIRST_NAME
LAST_NAME

log
LOG_ID
USER_ID
LOG_MESSAGE
LOG_DATE

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.