Jarzebowsky
Jarzebowsky

Reputation: 19

Picking up one record from MYSQL based on two tables

I have two tables:

order with row ID and ID_CLIENT

and

user with row ID, FIRSTNAME, SURNAME, PHONE etc.

My problem is:

I want to see order details like names, phone number on page to exactly client id of order I'm looking at.

Tried this:

SELECT name FROM client,order WHERE order.id_client=client.id

but it came up with more than one name that should came with.

Upvotes: 1

Views: 26

Answers (1)

ihsan
ihsan

Reputation: 2289

Your query is not complete.

SELECT name FROM client,order WHERE order.id_client=client.id AND client.id=999

Change 999 to your client id.

Upvotes: 1

Related Questions