[thelist] selecting above and below ranges in a SQL query [long]

Jay Blanchard jay.blanchard at niicommunications.com
Mon Aug 26 13:31:01 CDT 2002


[snip]
>  I want the 6 if there is not seven rows.

then 3 queries -- less than, greater, and equal

you cannot combine the equal query with either of the other two, because
you cannot easily flip from LIMIT 3 to LIMIT 4 to include the equal row
[/snip]

For the sake of efficiency I guess I could do two queries with LIMIT 4 and
test if there is a match in both queries on the <= or >=. Then I could print
out the row once. Just gotta' make sure to document the action properly.

Jay





More information about the thelist mailing list