What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Mysql Help

Mysql Help
Author: Message:
wj
Former Admin
*****

Avatar
I aim to misbehave.

Posts: 2224
Reputation: 52
39 / – / Flag
Joined: Mar 2002
O.P. RE: Mysql Help
Thats why you do the order by diff.

Notes are in { }
SELECT discountstandard.* {< selects all the fields from the table}, ABS(quantity - <your value>) {<Creates a positive value from the data in the DB - the value you are looking for. This gives you the distance between the value in the DB and the value you want to find} AS diff {places the value into a psudeo column} FROM discountstandard {The table} ORDER BY diff {Sorting by the distance from your desired number}  ASC LIMIT 5


Does that make sense?
"A towel is about the most massively useful
thing an interstellar hitchhiker can have."
04-27-2007 06:28 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Mysql Help - by wj on 04-27-2007 at 05:22 AM
RE: Mysql Help - by John Anderton on 04-27-2007 at 06:18 AM
RE: Mysql Help - by wj on 04-27-2007 at 06:28 AM
RE: Mysql Help - by John Anderton on 04-27-2007 at 06:35 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On