On 3/1/08, Gilles Ganault <[EMAIL PROTECTED]> wrote:
> Hello
>
>         I have two tables: Table1 has about 10 columns, Table2 has 2. I need
>  to get all the columns of Table1 and only one column in Table2 where
>  some field in Table1 is equal to field1 in Table2.
>
>  This doesn't work as intended, because it returns all the rows,
>  effectively ignoring the WHERE part:
>
>  SELECT * FROM table1,table2 WHERE table1_field10=table2_field1;
>
>  => Is there a smarter way to solve the problem than replacing "*" with
>  every single column, ie.
>
>  SELECT table1_field1, table1_field2... table1_field10,table2_field1,
>  table2_field2 FROM table1,table2 WHERE table1.field10=table2.field1;
>


SELECT table1.*, table2.col1
FROM table1 JOIN table2 ON table1.field10 = table2.field1
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to