Re: Display Records in certain order (string contained in field)
- From: "Randy" <*randyfromsono@xxxxxxxxx>
- Date: Sat, 2 Aug 2008 16:15:34 -0400
Thanks very much. Yes I should have specified which database type. As it
turns out I just switched from Access to SQL Server, and this query works
perfectly.
Also looked at the article you quoted. I'm in the process now of getting rid
of all those SELECT *'s.
"Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx> wrote in message
news:eaIIQSM9IHA.1420@xxxxxxxxxxxxxxxxxxxxxxx
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:
- Re: Display Records in certain order (string contained in field)
- From: Bob Barrows [MVP]
- Re: Display Records in certain order (string contained in field)
- References:
- Display Records in certain order (string contained in field)
- From: Randy
- Re: Display Records in certain order (string contained in field)
- From: Bob Barrows [MVP]
- Display Records in certain order (string contained in field)
- Prev by Date: Re: 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: Re: 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