Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CROSS JOIN, ONE TABLE HAS NO DATA 1

Status
Not open for further replies.

christer99

IS-IT--Management
Dec 3, 2001
247
How would I join two tables, using CROSS JOIN, or another method, if one table might have no rows (it could have rows, but it could also have no rows). There is no common identifier, so CROSS JOIN is the only alternative as I can see it. However, if one table has no data (no rows), the statement gives no output (although the first table has one row of data).

SELECT *
FROM ProgramConf CROSS JOIN
WorkloadConf
 
You better test this every which way you can think of because I am not confident that this is what you want.

Code:
SELECT *
FROM   ProgramConf 
       Left JOIN WorkloadConf
         On 1=1

Instead of Left Join, you may want to try Full Outer Join.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Great! That worked. Thank you very much
 
You posted 3 minutes after I did. In my opinion, this is not enough testing. Please test this when there are multiple records in each table. Make sure the output is what you expect it to be.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Each table will only hold one row of data (or no rows of data). Multiple rows is not an option for these two table as they hold the configuration to my program. I used the full outer join and it worked perfectly. Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top