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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unique Display Problem

Status
Not open for further replies.

ietprofessional

Programmer
Apr 1, 2004
267
US
I want to write a query that will display records that have x in the numberone column and the rest displaying below, ordered by column numbertwo.

Can someone help with this?

THANKS!
 
Can you please post some input example and expected result ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I need this kind of output, assuming the first column is normally the ordered column. Instead I need the fourth column that equals 'Processing' to come first and then the stuff below should be ordered by the first column.

8 - FirstName8 - LastName8 - Processing
9 - FirstName9 - LastName9 - Processing
1 - FirstName1 - LastName1 - Some Description
2 - FirstName2 - LastName2 - Words
3 - FirstName3 - LastName3 - Text
 
Add a sort field in your query:
SortField: IIf([column4]="Processing", 1, 2)
Sort by this field and the 1st column

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
SELECT Table.x0, Table.x1
FROM Table
order by IIf([x1]="Processing", 1, 2)and Table.x0


This isn't working when I put the 'and Table.x0 ' in the query. Without the 'and Table.x0' part it does put the columns containing 'Processing' on top though.

What am I doing wrong?
 
This works:

SELECT Table.x0, Table.x1
FROM Table
order by IIf([x1]="Processing", 1, 2), Table.x0

What exactly is the second and third params doing in the IIF?
 
I can't understand everything that you have posted. However, you seem to want a two-part sort. Try this~

ORDER BY IIf([x1]="Processing", 1, 2), table.x0;
 
What exactly is the second and third params doing in the IIF
IIf is a VBA function, so I suggest you to press the F1 key when the cursor is on the IIf word while in VBE.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Take a look at something like CASE WHEN

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top