You are doing a cross-join which returns one row for each possible pairing
of rows from the two tables.

To correct use an inner join alike

select t1.a,t1.b,t2.n,t1.c,t1.d,t1.e from t1,t2 where t1.a = t2.a limit 3

or like

select t1.a,t1.b,t2.n,t1.c,t1.d,t1.e from t1 inner join t2 on t1.a = t2.a
limit 3

I am assuming that column "a" exists in both tables and this column creates
a relationship between both tables.

-----Original Message-----
From: andu [mailto:[EMAIL PROTECTED]
Sent: 11 December 2003 16:50
To: [EMAIL PROTECTED]
Subject: select on 2 tables


What I'm trying to do is a select on 2 tables so that the result would be 2
columns from the first table, a column from the second and another 3 columns
from
the first one. I do:

select t1.a,t1.b,t2.n,t1.c,t1.d,t1.e from t1,t2 limit 3

What I get is the columns in the correct order but only the first row from
t1
repeated 3 times and rows 1,2,3 from t2. If I reverse the order of tables,
(... from t2,t1), the result is also reversed, rows 1,2,3 from t1 and row 1
repeated 3 times from t2. What am I doing wrong, if anyone can help me? I'm
using
sqlite 2.7.6 if that makes a difference.


-- 
Regards, Andu Novac

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to