tags:

views:

53

answers:

1

Hi All, What is meaning of single column in Join condition expession. Eg. In the following query, what table5.col_int_key and table2.pk predicate do ? Is it simply colval !=0 ?

SELECT STRAIGHT_JOIN COUNT(table1 .col_int) 
FROM   g table1 
       RIGHT JOIN e table2 
                  LEFT JOIN m table3 
                            LEFT JOIN a table5 
                              ON table5 .col_int_key 
                    ON table2 .col_int_key = table3 .col_int 
         ON table2 .pk; 
/* TRANSFORM_OUTCOME_UNORDERED_MATCH */; 
+2  A: 

I'm guessing you're using MySQL, the only database that evaluates single columns as booleans. So you are correct that it's equivalent to colval != 0, which is true ifcolval isn't null or 0.

A primary key typically isn't null or 0, so you can probably replace the right join with a cross join.

Andomar
Oh ya.. it is mysql db, Thanks for answer.
Prafulla