"Igor Tandetnik" wrote on Friday, January 24, 2014 9:48 AM...


On 1/24/2014 9:28 AM, jose isaias cabrera wrote:

Igor Tandetnik wrote...
On 1/23/2014 2:26 PM, St. B. wrote:
SELECT * FROM A WHERE projid in (SELECT projid FROM B WHERE ptask =
'a');

will probably fill the bill.

If I where to run your query, I would do a
select A.* from A inner join B on A.a = b.ProjId where b.ptask='a'

Careful - this will produce a different result if B has multiple rows
with the same ptask and projid. May or may not be a concern in the
OP's case.

What would be the correct inner join syntax to provide the same output as
the original select?  I like that shorter syntax.  Will any of these
will be
faster?  Thanks so much.

"SELECT DISTINCT ..." perhaps. But that would kill any alleged performance improvement that a join may have over IN (if any; personally, I'm not sure it's necessarily true that the join would perform better in the first place).

You are right, Igor. Your original IN command is much faster.  It instantly
responds, while the INNER JOIN takes a few second before responding.
Thanks.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to