Jump to content

Exporting specific details from database


salvador21
 Share

Recommended Posts

What I want to do is extract details of all orders with a specific product ID between two specific dates. The details I would need are basically the customer name and email address. Even just the email addresses would be fine.

 

Can  anyone please tell me if this is something that is possible and how to do it?

Link to comment
Share on other sites

SELECT first_name,last_name,email
FROM CubeCart_order_summary AS os
LEFT JOIN CubeCart_order_inventory AS oi
ON os.cart_order_id = oi.cart_order_id
WHERE os.cart_order_id BETWEEN aaaaaa AND bbbbbb+1
AND oi.product_id = ##

 

Make sure to include any table prefix if your CubeCart database uses one.

 

I chose to use the date that is inherent in the Order Id (first six digits) rather than the Order Date so that you don't have to convert the desired dates to Unix Timestamps

 

'aaaaaa' would be something like 130701 and 'bbbbbb+1' would be the day after the maximum day, like 130801.

 

'##' is the product_id you are targeting.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...