Jump to content

SQL Query: Basic Help


1oid

Recommended Posts

Hey everyone,

I have spotted some SQL written by @vekia and I'm trying to butcher it to pull the firstname, surname, email address and serial number from a particular product(from serial number module - haven't worked out the ID for that yet) could anyone help me understand where I am going wrong? (First time reading SQL - just spent an hour on w3schools)

Quote

SELECT C.email,
C.firstname,
C.lastname, 
FROM ps_customer C 
INNER JOIN ps_orders O on C.id_customer = O.id_customer
INNER JOIN ps_order_detail OD on O.id_order = OD.id_order
WHERE OD.product_id =49

 

Link to comment
Share on other sites

@joseantgv such a simple fix, thank you very much! I've tried to identify the id of serial numbers attached to an order and I'm thinking it may look something like this, could I ask for a further look from you?

 

Quote

SELECT C.email,
C.firstname,
C.lastname,
K.key_value
FROM ps_customer C 
INNER JOIN ps_orders O on C.id_customer = O.id_customer
INNER JOIN ps_order_detail OD on O.id_order = OD.id_order
INNER JOIN ps_keymanager OD on O.id_order = OD.id_order
WHERE OD.product_id =49

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...