Click here to Skip to main content
15,168,971 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi Everyone,

I have a list of Currencies in one Table.

TABLE A:

Currency
--------
Pound
Dollar
Yuan

Then I have list of Users in another Table.

TABLE B:

User
----
ABC
XYZ

Can I do I join of some sort on Table A and B to get the following result.

RESULT:

User | Currency
--------------
ABC | Pound
ABC | Dollar
ABC | Yuan
XYZ | Pound
XYZ | Dollar
XYZ | Yuan

I have tried joins, but they need a field to compare. In this care there is none.

Please help.
Posted
Updated 16-Feb-21 15:37pm

If the server does not support CROSS JOIN syntax, you may use the following:
SQL
SELECT a.User, b.Currency FROM TableA a, TableB b
   
Why do you required to write query without matching column .... ?
   
Okay - I got it working.

Stupid not to try it in the first place.

SELECT User,Currency FROM TableA CROSS JOIN TableB
   
Try this,

SQL
Select * from Table A, Table B
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900