Re: Display Records in certain order (string contained in field)
- From: "Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx>
- Date: Sat, 2 Aug 2008 13:24:09 -0400
Randy wrote:
Just can't figure out how to do this..........
I have a simple asp page that desplays images from database.
What database? Type and version please ... these are almost always relevant
and they are definitely relevant for this question.
The query on my page:
-------------------------
imagequery = "SELECT * FROM FILE_LIST WHERE CLASS_ID=" & FORM_ID
Nothing to do with your problem but ...
http://www.aspfaq.com/show.asp?id=2096
------------------------
The table FILE_LIST contains a field called TITLE which never gets
displayed.
(the form_id comes from a selection on previous page)
I display the images with a do loop as follows:
---------------------------
I hope I've explained this adequately.
Thanks in advance to anyone who has any ideas.
I cannot get specific, but the sql dialect for whatever database you are
using undoubtedly has string functions to enable you to accomplish this in
your sql statement. Like this:
Access:
imagequery = "SELECT * FROM FILE_LIST " & _
"WHERE CLASS_ID=" & FORM_ID & _
" ORDER BY iif(Instr([TITLE],"photo")>0,0,1) ASC
SQL Server:
imagequery = "SELECT * FROM FILE_LIST " & _
"WHERE CLASS_ID=" & FORM_ID & _
" ORDER BY CASE WHEN TITLE Like '%photo%' " & _
"THEN 0 ELSE 1 END ASC"
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
.
- Follow-Ups:
- References:
- Prev by Date: Display Records in certain order (string contained in field)
- Next by Date: Re: Display Records in certain order (string contained in field)
- Previous by thread: Display Records in certain order (string contained in field)
- Next by thread: Re: Display Records in certain order (string contained in field)
- Index(es):
Relevant Pages
|
Loading