On Sat, 1 Mar 2008 15:35:01 -0500, "P Kishor"
<[EMAIL PROTECTED]> wrote:
>SELECT table1.*, table2.col1
>FROM table1 JOIN table2 ON table1.field10 = table2.field1
Thanks for the tip, but...
1. I want to SELECT all the columns from Table1 and one column from
Table2, but only rows WHERE table1.field10 = 1. The above SELECT
returns all the rows from Table1.
I put the SQL commands in my other reply, so it makes more sense.
2. I can't use the "." notation because PHP doesn't allow this as
column names in associative arrays.
For instance, this doesn't work:
=======
$dbh = new PDO("sqlite:test.sqlite");
$sql = "SELECT Table1.*, Table2.name FROM Table1 JOIN Table2 ON
Table1.table2id = Table2.id";
$rows = $dbh->query($sql);
while($row = $rows->fetch(PDO::FETCH_ASSOC) ) {
//Nothing shown...
echo sprintf("%s<p>",$row['Table1.name']);
}
$dbh = null;
=======
So the solution I found is use absolute names for all columns, eg.
Table1_table2id. I should have specified this in the orignal post.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users