Forum Moderators: open

Message Too Old, No Replies

Displaying rows as columns

Dynamic tables problem

         

aspdaddy

4:47 pm on Aug 18, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi I have this normalised recordset/array that stores sales and the options selected. Imagine the different options to choose when you buy a car, (stereo, leather seats etc) so the data looks like this :

Sales ID Option
------- ------
001 01
001 02
001 03
002 02
003 01
003 03

Now I need to display orders in batches on the screen and the client wants columns for each option and ticks or Y/N against the options selected so it looks like this:

Sale ID Options: 01 02 03
001 Y Y Y
002 N Y N
003 Y N Y

I tried using SQL Crosstab function to get the data out in the right format but it wont work because the product-options table has over 8,000 rows - although no more than 20 for each product. I dont want 8000 columns displayed every time, just those that apply to the orders selected which will always be for the same product.

I need to do this by either finding a component designed for this task, or hand coding HTML tables and loops with the data in either an array or adodb recordset, right? I cant think of any easier/quicker ways.

Does anyone know of a component or code that can solve this one?

Thanks.

liushiping

12:54 pm on Sep 3, 2006 (gmt 0)

10+ Year Member



Oh, This is a very difficult problem.
First,you must select some one and only Salvs ID,than use those ID to select others.

aspdaddy

8:10 pm on Sep 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yeah its a solution but its way too may calls to the database, and ill never be able to use a remote database or scale up if im using more than one call.

I found a kinda solution here using two recordsets, but its not ideal.

[weblogs.sqlteam.com...]