Re: Display Records in certain order (string contained in field)



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"



.



Relevant Pages

  • RE: full-text search failed with one million of key words (Sqlserv
    ... Research with "toto" was just a test. ... In real life, my database contains ... for only one book) And the table i want to query looks like this: ... I have to make big tests with sql server 2005 express (i'm waiting credits ...
    (microsoft.public.sqlserver.fulltext)
  • Re: Error 25081: Incorrectly generating identities after a merge
    ... database similarly to SQL Server CE Replication. ... On the SQL Server 2000 database with replicated tables from the original ... The I synchronized that database and ran the same query: ... >> synchronization. ...
    (microsoft.public.sqlserver.ce)
  • Re: Looking for a professional SQL programmer for a small job
    ... Pro SQL Server 2000 Database Design - ... I have two queries to build and while I know my way around SQL, ... >> One is a seach query that pull rental properties from a database based on ...
    (microsoft.public.sqlserver.programming)
  • Re: Using a worksheet as a table in an SQL query
    ... I'll probably just dump the SQL Server data to a spreadsheet and join the two spreadsheets. ... You could use Access to link to both sources and create a crosstab query. ... There are ways to enter the data into their database via the application, but it would require them to go to many different windows instead of being able to enter the data all on one screen. ... There is not a great deal of data they would enter on the spreadsheet, but I'm not sure how slow that would make the query. ...
    (microsoft.public.excel.programming)
  • Re: Issue with a table that is 75%-80% of the database size
    ... SQL Server 2000 does not support table partitioning. ... Have you tried database differential backup? ... your query response time and backup time. ...
    (microsoft.public.sqlserver.server)

Loading