Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 14th, 2005, 05:41 AM
Registered User
 
Join Date: Oct 2005
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.
  #2 (permalink)  
Old October 17th, 2005, 07:01 AM
Authorized User
 
Join Date: Sep 2005
Location: , , .
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes this is a cross tab query take a look at http://www.aspfaq.com/show.asp?id=2462
http://sqlservercode.blogspot.com/
  #3 (permalink)  
Old October 17th, 2005, 09:33 PM
Friend of Wrox
 
Join Date: Aug 2004
Location: Orange County, CA, USA.
Posts: 385
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

  #4 (permalink)  
Old October 17th, 2005, 11:43 PM
Registered User
 
Join Date: Oct 2005
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

  #5 (permalink)  
Old October 19th, 2005, 06:33 PM
Friend of Wrox
 
Join Date: Aug 2004
Location: Orange County, CA, USA.
Posts: 385
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cross-Tab query subhanak Access 2 March 3rd, 2008 06:50 PM
Query building anjurenjith SQL Language 0 August 2nd, 2007 05:07 AM
Creating Cross-Tab query in SQL? WebLadyBug SQL Server ASP 0 March 9th, 2007 09:57 AM
Cross Tab query aware SQL Server 2000 3 June 29th, 2006 04:22 PM
running out of field in query building yixchen Access 2 December 19th, 2005 10:19 AM





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