Jump to content
GMM148

SQL Assistance

Recommended Posts

Anyone out there who is good at SQL who could put together a report format for me based on particular requirements? Happy to pay reasonable amount to be agreed beforehand.

Site is non-commercial, it's a club website, just need to run reports on who has booked for when and how many?

THanks

 

Share this post


Link to post
Share on other sites

Hi thanks and sorry for the delay.

I already have an SQL query but need to customise it for better output for particular product orders, given that this is for a club, so people book in and then cancel/change bookings. The current query is shown below:

SELECT DISTINCT c.`id_customer`, CONCAT(c.`firstname`,' ', c.`lastname`) as customer, c.`email` 
FROM `ps_customer` c LEFT JOIN `ps_orders` o ON (c.`id_customer` = o.`id_customer`) LEFT JOIN `ps_order_detail` od ON o.`id_order` = od.`id_order`
WHERE od.`product_id` = 13

I want to keep this report but ensure the following:

1. Product ID remains at the end so it be quickly edited

2. I only want to show Customers whose orders have been 'DELIVERED' - if they have subsequently CANCELLED I don't want them to show

3. Currently if an 'order/booking' is 'returned to stock' it still shows up on the output list - I don't want to show 'returned to stock' orders

4. I want to show how many items a customer has ordered - currently even if they have ordered multiples, even if they have done it on separate occasions, it shows up just once - so I need to see 'product quantity'

Any thoughts appreciated.

thanks

Share this post


Link to post
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.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More