Reputation: 254
Can any one suggest which one is better in this case:
SELECT
COLUMN1,
(SELECT
COLUMN2
FROM
TABLE2
WHERE
<some condition>) AS COLUMN2
FROM TABLE 1
SELECT
T1.COLUMN1,
T2.COLUMN2
FROM
TABLE1 T1
INNER JOIN
TABLE2 T2 ON <some condition>
Upvotes: 3
Views: 1694
Reputation: 13571
There are several axis of "better"...
Better flexibility ....
So,
Better is frequently just a trade off...
Upvotes: 4
Reputation: 160943
Which is better?
It is not the problem which is better, because they are complete different query.
Your first query will be error if your sub query return more than 1 row.
Upvotes: 2