Jump to content

Really stuck - any ideas??


stebuWRRt06

Recommended Posts

Hi,

 

Thanks for taking a look at this. I need to generate a report by querying the database, but i keep having problems. The report i need to generate should look like something below

 

                                SS10 | SS20 | SS30 | SS40 | SS50 | SS60 | (product codes)

 

Company A                    1        1

Company B                              1        1                    1        1

Company C                    1                  1          1

 

 

Basically i delivery date is posted and i need to display all product codes, then display all the companies that have ordered for that delivery date (not all companies are diaplyed) and display which particular product they have ordered. I should mention that products, companies and , order and order details are in seperate tables. The relationship details:

 

order - delivery date (posted date)

companies and order are linked with company id

order details and orders are linked with order id

order details and products are linked with product id

 

 

Thanks in advance for any help, advice, suggestions. Have a nice day!!

 

Regards,

 

Steven

Link to comment
https://forums.phpfreaks.com/topic/45039-really-stuck-any-ideas/
Share on other sites

Your query needs to be like this

SELECT c.company_name, d.product_id, d.qty
FROM order_detail d
INNER JOIN order o ON o.order_id = d.order_id
INNER JOIN companies c ON o.company_id = c.company_id
WHERE o.delivery date = '$search_date'

 

Given the format of your output, I'd store the results into an array and then output the array data.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.