Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query help needed! Simple one. 1

Status
Not open for further replies.

Tursas

Technical User
Sep 4, 2004
4
FI
Hello People!

This is probably peace of cake for lots of you, but I am novice in SQL. Plaese help me with my problem. This is a simplyfied example.

I have a database where are following tables:

Products
Users

Users table includes following columns:

UserID
UserName

Product table includes following columns:

ProductID
InsertDate
InsertBy
ChangeDate
ChangeBy
ProductName
ProductDescription

How can I make a query that comes up with a following result:

ProductName InsertDate InsertBy ChangeDate ChangeBy
----------------------------------------------------
Car 18/9/03 Mark 20/6/04 James

Please help me with this one.

I got this far.........

SELECT *
FROM product, users
WHERE product.insertby=users.userid

What shoul I do next??

Thank you!

Tursas
 
Code:
SELECT ProductName, 
       InsertDate 
       ui.username as InsertBy,
       ChangeDate,
       uc.username as ChangeBy
FROM product , users ui, users uc.
WHERE product.insertby=ui.userid
and product.changeBy = uc.userid
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top