dbTalk Databases Forums  

for alexp

comp.databases.mysql comp.databases.mysql


Discuss for alexp in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
strawberry
 
Posts: n/a

Default for alexp - 09-26-2006 , 07:33 AM






SELECT name
FROM `table`
ORDER BY ABS( `age` -43 ) ASC
LIMIT 1

Of course, this doesn't account for ties. To do that I guess you could
have this query as a subquery and then LEFT JOIN where age = 43 +/-
difference, but I'll leave that as an exercise for the reader.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.