Given a table t (name, date)

  I want to find all rows within, say, 6 months of a specific row, say
name = 'foo'. So, I am doing

  SELECT name
  FROM t
  WHERE
    (SELECT julianday(date) FROM t WHERE name = 'foo') -
julianday(date) < 180 OR
      julianday(date) - (SELECT julianday(date) FROM t WHERE name = 'foo') < 180

Somehow the above doesn't seem very efficient what with two
sub-selects and all. Suggestions please.

-- 
Puneet Kishor
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to