Re: Order by 4 columns at once
From: Tom Ellison (tellison_at_jcdoyle.com)
Date: 03/31/04
- Next message: Gary Walter: "Re: querydef help missing."
- Previous message: May: "Migrating to SQL Server from Access"
- In reply to: Michael Hetrick: "Order by 4 columns at once"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 31 Mar 2004 09:05:07 -0600
Dear Michael:
First, I suggest you construct a query with a new column that gives
the value on which you would sort. Depending on your need, this might
be:
Nz(Nz(Nz(Nz(Col1, Col2), Col3), Col4), 0)
Meaning use Col1 unless it is null, in which case, use Col2 unless
that is null, etc. Use 0 if all are null.
By making this a column first, before trying to sort on it you can see
that it is doing what you really want. Then turn off displaying this
column and sort on it.
Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
On Wed, 31 Mar 2004 09:22:44 -0500, "Michael Hetrick"
<m1hetric@gc.com> wrote:
>I need to generate a report from a table that may or may not have data in 4
>columns and order by those 4 columns at once.
>
>ID | Col1 | Col 2 | Col3 | Col4 | Title
>1 | 4 | | | | some text
>2 | | 2 | | | some text
>3 | | | | | some text
>4 | 9 | | | | some text
>5 | | | 7 | | some text
>
>The report should look like this:
>
>Col | Title
>2 | some text
>4 | some text
>7 | some text
>9 | some text
>
>I know that this would be easier in a relational table structure, but it
>isn't an option to design the tables correctly at this time. The final
>output will be displayed in a web page. Any assistance would be
>appreciated!
>
>Thanks -
>Michael
>
- Next message: Gary Walter: "Re: querydef help missing."
- Previous message: May: "Migrating to SQL Server from Access"
- In reply to: Michael Hetrick: "Order by 4 columns at once"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|