Rupesh Mishra
asked on
Whats wrong in this query - Select * from tableA,tableA
Whats wrong in this query - Select * from tableA,tableA
SELECT * FROM tableA a
CROSS APPLY ( SELECT * FROM tableA b ) k
CROSS APPLY ( SELECT * FROM tableA b ) k
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Technically it will return error because you can't have 2 same names for objects (you need to provide alias at least for one of them). But what do you want to achieve?
What are you trying to do?
ASKER
cartesian product
I have given you the solution in the first comment. Have you tried.?
Give aliases to your table and it should work:
Select * from tableA as A1,tableA as A2
Then it only misses an alias like said before:
But I'm curious where you're going to use the result of the query.
Select * from tableA,tableA B
But I'm curious where you're going to use the result of the query.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Jim, Your link is really helpful for future.
Select * from tableA alias1 ,tableA alias2
or
SELECT * FROM tableA a CROSS JOIN tableA b