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

Number Range Query
Author: Message:
Adeptus
Senior Member
****


Posts: 732
Reputation: 40
Joined: Oct 2005
RE: Number Range Query
Dempsey,

If you have a list of values you want, SQL has the IN operator:

SELECT * FROM foo WHERE bar IN (29, 32, 33, 37, 45, 78, 82, 200, 678, 680, 683, 690, 705)

The list can result from a subquery, so if your list is too long to specify as literals, you could create a temporary table, insert all the values you want in it, and then:

SELECT * FROM foo WHERE bar IN (SELECT bar FROM tmptable)

Of course, if the list is somehow derived from the database, you should just use that query directly and avoid the need for temporary tables.  This is where the context of what you are doing becomes important -- unless the arbitrary list is truly arbitrary (e.g. user selected), there probably is a better way.

03-01-2006 05:34 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Number Range Query - by Dempsey on 03-01-2006 at 12:50 PM
RE: Number Range Query - by RaceProUK on 03-01-2006 at 01:48 PM
RE: RE: Number Range Query - by Dempsey on 03-01-2006 at 02:32 PM
RE: Number Range Query - by Adeptus on 03-01-2006 at 05:34 PM
RE: Number Range Query - by Dempsey on 03-01-2006 at 05:54 PM
RE: Number Range Query - by Adeptus on 03-01-2006 at 06:34 PM


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