Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Permutations of Recordset


Message #1 by "Jose Haymaker" <ehaymaker@a...> on Mon, 7 Jan 2002 21:21:01
 have a table 

In the table are fields a1-a20 

I want to have a permutation of every possible combination of the a1-20 



Such as 



copper 10 black 

copper 10 g reen 

copper 10 pink 

copper 10 blue 

copper 20 black 

copper 20 green 

copper 20 pink 

copper 20 blue 

copper 30 black 

copper 30 green 

copper 30 pink 

copper 30 blue 





aluminum 10 black 

aluminum 10 green 

aluminum 10 pink 

aluminum 10 blue 

aluminum 20 black 

aluminum 20 green 

aluminum 20 pink 

aluminum 20 blue 

aluminum 30 black 

aluminum 30 green 

aluminum 30 pink 

aluminum 30 blue 



brick 10 black 

brick 10 green 

etc.etc 





Is there a query for that?  Or VBscript code for that? 
Message #2 by Todd Carrico <ToddC@m...> on Mon, 7 Jan 2002 15:21:23 -0600
Try this



SELECT T1.*, T2.*

FROM Table1 T1, Table T2

-- Notice, no join criteria.



It is called a cartesian product.





tc





-----Original Message-----

From: Jose Haymaker [mailto:ehaymaker@a...] 

Sent: Monday, January 07, 2002 3:21 PM

To: ASP+

Subject: [aspx] Permutations of Recordset



 have a table 

In the table are fields a1-a20 

I want to have a permutation of every possible combination of the a1-20 



Such as 



copper 10 black 

copper 10 g reen 

copper 10 pink 

copper 10 blue 

copper 20 black 

copper 20 green 

copper 20 pink 

copper 20 blue 

copper 30 black 

copper 30 green 

copper 30 pink 

copper 30 blue 





aluminum 10 black 

aluminum 10 green 

aluminum 10 pink 

aluminum 10 blue 

aluminum 20 black 

aluminum 20 green 

aluminum 20 pink 

aluminum 20 blue 

aluminum 30 black 

aluminum 30 green 

aluminum 30 pink 

aluminum 30 blue 



brick 10 black 

brick 10 green 

etc.etc 





Is there a query for that?  Or VBscript code for that? 





  Return to Index