Thanks Paul for that.
 
I've now got 
sql = "SELECT * FROM quest WHERE questID = '" & questID & "' AND questnumber
IN (" & questreq & ")"
working, but the results aren't coming up in questreq order, they are always
coming up in ascending numerical order.
 
I've tried things like:
sql = "SELECT * FROM quest WHERE questID = '" & questID & "' AND questnumber
IN (" & questreq & ") ORDER BY questnumber (" & questreq & ")"
and
sql = "SELECT * FROM quest WHERE questID = '" & questID & "' AND questnumber
IN (" & questreq & ") ORDER BY questnumber IN (" & questreq & ")"
 
but it always fails!
 
Is there something fundamental that I'm going wrong?
 
Many thanks
 
 
Alex
 
 
NOTE: The information contained in this email is intended for the named
recipients only, it may be privileged and confidential. If you are not the
intended recipient, you must not copy distribute or take any action in
reliance upon it. No warranties or assurances are made in relation to the
safety and content of this email and any attachments. No liability is
accepted for any consequences arising from it.
 

  _____  

From: Paul Manzotti [mailto:[EMAIL PROTECTED] 
Sent: 30 October 2004 10:58
To: [EMAIL PROTECTED]
Subject: Re: [ASP] SQL statement and result ordering....


Alex wrote:

>I have the SQL statement:
> 
>sql = "SELECT * FROM quest WHERE questID = '" & questID & "' ORDER BY
>questnumber ('3,5,9')"
> 
>In the database, there are several sets of questions (hence the questID
>field), but then I want to just to be able to pick out a selected number
(in
>this case 3, 5 and 9)
> 
>The statement and page works with:
>sql = "SELECT * FROM quest WHERE questID = '" & questID & "' ORDER BY
>questnumber ASC"
> 
>What do I need to do to make it work with a specific set of question
>numbers?
>  
>
Don't you just need to extend the Where clause?

sql = "SELECT * FROM quest WHERE questID = '" & questID & "' AND questnumber
IN ('3,5,9') ORDER BY
questnumber ASC"

I think that's the correct syntax for the IN clause, but I can't be sure.

manzo


---------------------------------------------------------------------    
Home       : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
Post       : [EMAIL PROTECTED]
Subscribe  : [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
--------------------------------------------------------------------- 



Yahoo! Groups Sponsor   

ADVERTISEMENT
 
<http://us.ard.yahoo.com/SIG=12924to2p/M=315388.5543473.6613715.3001176/D=gr
oups/S=1705115381:HM/EXP=1099220264/A=2372354/R=0/SIG=12id813k2/*https://www
.orchardbank.com/hcs/hcsapplication?pf=PLApply&media=EMYHNL40F21004SS> click
here    
 
<http://us.adserver.yahoo.com/l?M=315388.5543473.6613715.3001176/D=groups/S=
:HM/A=2372354/rand=252237601>   

  _____  

Yahoo! Groups Links


*       To visit your group on the web, go to:
http://groups.yahoo.com/group/active-server-pages/
  

*       To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>

  

*       Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> . 




[Non-text portions of this message have been removed]






------------------------ 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/17folB/TM
--------------------------------------------------------------------~-> 

---------------------------------------------------------------------    
 Home       : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
 Post       : [EMAIL PROTECTED]
 Subscribe  : [EMAIL PROTECTED]
 Unsubscribe: [EMAIL PROTECTED]
--------------------------------------------------------------------- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/active-server-pages/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to