Jump to content

Formatting each row of results and grouping by category?


sciulli

Recommended Posts

I've spent 6+ hours and have only managed to get errors, all results on one line, or all the results in the same format. I could post some of my sample code, but it's useless. If someone could point me in the right direction, or even provide a relevant tutorial link for this type of process it would be greatly appreciated.

I am trying to query the database to list all orders while grouping them by category and displaying different rows in different formats. Here's a sample of my database:

Table product_categories
------------------------
product_cat_desc product_cat_number
mens 1
womens 2

Table products
--------------
product_id product_desc product_cat
34 long sleeve 1
35 short sleeve 2

Table orders
------------
order_date order_id
02-11-2005 3
02-10-2005 4
02-11-2005 5

Table orders_products
---------------------
order_product_id order_id
34 3
35 4
34 5

Table orders_products_options
------------------------------
order_option_title order_product_value order_id
size large 3
color blue 3
size small 4
color pink 4
size medium 5
color gray 5

What I would like to do (if it's even possible) is:
group each order by product_categories
display the category heading as underlined
if the order_option_title is "size" display the order_product_value in bold
if the order_option_title is "color" display the order_product_value in italics

Mens (underlined)

Large (in bold)
blue (in italic)

Medium (in bold)
gray (in italics)

Womens (underlined)

Small (in bold)
pink (in italics)

Thanks in advance to anyone who can guide me.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   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

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.