Forums

This topic is locked

"ORDER BY" querie

Posted 25 Jan 2002 03:27:13
1
has voted
25 Jan 2002 03:27:13 Adam Toohey posted:
Hi,

I have a search engine where I sort my results by business name. This works fine. I have some customers that pay me to be on my search results. I want to be able to put the paying customers results first and order the rest of the results alphabetically by business name. I have been trying ORDER BY WebSiteLink, BusName but this doesn't work. I am confident that is a simple problem for experts in SQL. Thanks for any help.

Adam Toohey

Replies

Replied 25 Jan 2002 09:44:36
25 Jan 2002 09:44:36 Viktor Farcic replied:
Lets assume that you have checkbox (Paid) in DB that is checked for each user that has paid. SQL would look like:
SELECT *
FROM TableName
ORDER BY Paid ASC, Name ASC

Depending on type of DB last line can look like:
ORDER BY Paid DESC, Name ASC

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Hi,

I have a search engine where I sort my results by business name. This works fine. I have some customers that pay me to be on my search results. I want to be able to put the paying customers results first and order the rest of the results alphabetically by business name. I have been trying ORDER BY WebSiteLink, BusName but this doesn't work. I am confident that is a simple problem for experts in SQL. Thanks for any help.

Adam Toohey


<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Viktor Farcic

TalkZone Manager

Edited by - vfarcic on 25 Jan 2002 12:39:18
Replied 25 Jan 2002 11:58:13
25 Jan 2002 11:58:13 Adam Toohey replied:
Hi Victor,

Thanks heaps, I have been working on this all day and pulling my hair out trying to figure it out. Thanks, it now works well <img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>

Adam

Reply to this topic