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

order by vs sort

Status
Not open for further replies.

DirtDawg

IS-IT--Management
Apr 17, 2002
218
JP
Hello all,

I have an Access program that outputs to a report.
I would like set the order based on one column. I would like to have one selection of the records be shown either first or last. Then the rest of the records to be shown Ascending. I there anyway to do this?

Thanks in advance
 
Hunnicutt,

Wiser readers may offer a better solution, but here is one.

You will need to use a UNION query.

SELECT tblSet.PK, tblSet.Info FROM tblSet WHERE (((tblSet.Info)= "gizmo"));

UNION SELECT tblSet.PK, tblSet.Info FROM tblSet WHERE (((tblSet.Info)<>gizmo)) ORDER BY tblSet.Info;

The preceeding example will produce a recordset containing all rows with tblSet.Info, but having "gizmo" as the first row.

Cheers,
Bill
 
Hi Hunnicutt,

Here's another way. I don't know which is better; I'd be interested in others' views.

[blue][tt]SELECT YourTable.*
FROM YourTable
ORDER BY YourTable.YourColumn = YourValue,
YourTable.YourColumn;[/tt][/blue]

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top