| | |
querry problem
Please support our MS SQL advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jul 2009
Posts: 1
Reputation:
Solved Threads: 0
I'd like to make a querry prom 2 tables that have the same information. Tables have only one column named "fish". I'd like to create a querry that will show me every combination from first table with the second table (in 2 separate columns). For example:
My table contains: A,B,C.
I'd like to get in the querry the following info:
column1 column2
A A
A B
A C
B A
B B
B C
C A
C B
C C
it would be great if in the querry i could eliminate the AA,BB and CC
. Thanks in advance
My table contains: A,B,C.
I'd like to get in the querry the following info:
column1 column2
A A
A B
A C
B A
B B
B C
C A
C B
C C
it would be great if in the querry i could eliminate the AA,BB and CC
. Thanks in advance Last edited by sebaz; Jul 1st, 2009 at 11:59 am. Reason: bad title
sql Syntax (Toggle Plain Text)
IF OBJECT_ID('Table1', 'U') IS NOT NULL DROP TABLE Table1 CREATE TABLE Table1 ( Fish VARCHAR(1) ) IF OBJECT_ID('Table2', 'U') IS NOT NULL DROP TABLE Table2 CREATE TABLE Table2 ( Fish VARCHAR(1) ) GO INSERT INTO Table1 (Fish) VALUES ('A') INSERT INTO Table1 (Fish) VALUES ('B') INSERT INTO Table1 (Fish) VALUES ('C') INSERT INTO Table2 (Fish) VALUES ('A') INSERT INTO Table2 (Fish) VALUES ('B') INSERT INTO Table2 (Fish) VALUES ('C') GO SELECT * FROM Table1,Table2 ORDER BY Table1.Fish, Table2.Fish
Results:
MS SQL Syntax (Toggle Plain Text)
(1 row(s) affected) Fish Fish ---- ---- A A A B A C B A B B B C C A C B C C
![]() |
Similar Threads
- SQL querry Combo Box Question (C#)
- Calculator Missing - help please (Windows NT / 2000 / XP)
- accessing an empty querry result (PHP)
- Accesing tables rows in Stored procedure without using cursors (MS SQL)
- Did Hubby Put Spyware on My PC??! (Viruses, Spyware and other Nasties)
- how to get value from an access querry in a variabe? (VB.NET)
- Simple ASP.Net Login Page (Using VB.Net) (ASP.NET)
- How To create A Detail Account Querry Sorted By Date (MS Access and FileMaker Pro)
- Creating a Database from scratch, need assistance (MS Access and FileMaker Pro)
- Intel mainboard D845HV, front panel configuration (Motherboards, CPUs and RAM)
Other Threads in the MS SQL Forum
- Previous Thread: Table Chaos
- Next Thread: Code inside CATCH not execute
| Thread Tools | Search this Thread |






