Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Order by ASC, DESC or any other ??? 1

Status
Not open for further replies.

arobbo

IS-IT--Management
Feb 15, 2005
62
0
0
GB
Hey guys

I've got a temp table that I want to organise by three headings.

terms, Special Offers and Contracts

Thing is i need to show all the data in the able and just bring the relevent one to the top.

I'm using a web page to display the data but is an access database and hopefully the solution with by in the SQL statement

so far i can bring terms and contracts to the top by using order by ASC and DESC but how can I bring special offer to the front ??? any ideas anyone...

Many thanks

Andy
 
If you need a specific way to sort Special Offers, you could add another field to the table or a query that identifies which values are the most important and then sort by that field. So if
3 for $1 is a special offer, in the sort field you create you could give it a 10, and then sort that field Decending. That would bring your 3 for $1 to the top of the list.

Paul
 
You can create a sort field with an 'iif':

[tt]SELECT *
FROM tblTable
ORDER BY IIf([TypeFieldName]='Special Offer',1,2);
 
oops
[tt]SELECT *
FROM tblTable
ORDER BY IIf([TypeFieldName]='Special Offer',1,2);[/tt]
 
Your a star Remou !!!

worked like a dream

Many thanks everyone for your input !!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top