Subject RE: [firebird-support] Getting the 'closest' return
Author Steffen Heil
Hi

select * from table a where a.field in
( select first 1 b.field from table b order by abs(b.field - ?) asc )

Regards,
Steffen

-----Original Message-----
From: dleec45 [mailto:dleec45@...]
Sent: Wednesday, June 09, 2004 5:44 AM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Getting the 'closest' return

How do I write a query which will return the closest value in the where
statement. If I have a bunch of numbers in a table that has values like
100, 200, 300, 400 and my where clause looks for 249 or 250, how do I return
200 or 200 and 300, whatever the case may be?



------------------------ Yahoo! Groups Sponsor --------------------~--> Make
a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/67folB/TM
--------------------------------------------------------------------~->


Yahoo! Groups Links