p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   SQL Server 2000 (http://p2p.wrox.com/forumdisplay.php?f=20)
-   -   Building Cross Query... (http://p2p.wrox.com/showthread.php?t=34273)

ZArrinPour October 14th, 2005 05:41 AM

Building Cross Query...
 
Hi all,
I want to create a Cross-Table or Cross-Query but i don't know
Where should i start with.?

Suppose we have a Table with following Specs:(only for test)

PID FID FName FValue
----- --- ---------- --------
108 2 Os Platform Windows XP Pro
108 3 Resolution 2400*4800 dpi
108 5 ScanAbility True
112 2 Os Platform Me, 98, 2000
112 3 Resolution 3200*6400 dpi
112 5 ScanAbility False
113
114
.....


As you might have already guessed,PID refer to Product Id and FID refer to
Field Id ,FName to FieldName and FValue to Field value.

Now I want to create a report like this:


---------------------------------------------------------------------
PID 108 112 113 114
---------------------------------------------------------------------
Os PlatForm Windows XP Pro Me, 98, 2000 ....
Resolution 2400*4800 dpi 3200*6400 dpi .....
ScanAbility True False

---------------------------------------------------------------------

Is it possible to creating such report.? if so,please help me.

Thanks in advance.
Regards.

SqlMenace October 17th, 2005 07:01 AM

yes this is a cross tab query take a look at http://www.aspfaq.com/show.asp?id=2462
http://sqlservercode.blogspot.com/

robprell October 17th, 2005 09:33 PM

My thoughts are the requestor appears to have an infinite possible number of rows in the results. The solution he was forwarded to assumes a finite number of rows. I would argue this is a bad idea from the start. Question is why do you want to do that? What your looking at is a pivot table that you can do in Excel but is not practical in SQL if its not a finite number of columns.


ZArrinPour October 17th, 2005 11:43 PM

Dear robprell,
Hi
Thanks for your Reply.Recently i was Asked to write a "Product Comparision" form for
a shop like www.Ebay.com!!! do you familiar with it?
in the ebay and after you find some products through serach,you can select some products and press "Compare" button under the list of the product.Then in another form you can see a Cross Query of selected product's specs.
I want to implement the same thing.But in Ebay they use Paging capability if you select more than 4 products, that i don't know how do they implement it.if you have any IDEA let me know.

Once again thanks for your Response.
Regards.


robprell October 19th, 2005 06:33 PM

So is your question. If you get a result set of say 200 rows, you want to allow the user to page through at say 10 rows of data at a time? If so I would not do this as a pivot table. Sorry I am familar with Ebay but not exactly sure what your seeking, perhaps I am not familiar with the "product comparision" functionality of ebay.



All times are GMT -4. The time now is 11:21 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.