sorting fields in a record

C

Carl

I have a set of numeric fields (6) and would very much like to know how to
have them sorted for my results. can u assiste by giving me some codes? eg,
Fruits Number
Apple 6
Mango 8
Orange 16
Pineapple 3
Banana 7
Cherry 25
Thanks alot.
 
C

Carl

Sorry I should have been a bit more specific, there is only 1 record with 6
fields: eg.
Number1 6
Number2 8
Number3 16
Number4 3
Number5 7
Number6 25

result should be sorted from lowest to higest

Number2 3
Number3 7
Number4 8
Number5 16
Number6 25

Hope i am making sense. thanks a lot
 
D

Duane Hookom

It kinda makes sense but is more than a bit unusual. I'm not sure why you
would have this type of un-normalized structure, why you would want to sort
across fields, and what happened to Number1 6.

Regardless, you can create a normalizing union query with sql like:
SELECT "Number1" as TheNumber, Number1 As TheValue
FROM tblNoNameGiven
UNION
SELECT "Number2", Number2
FROM tblNoNameGiven
UNION
SELECT "Number3", Number3
FROM tblNoNameGiven
UNION
SELECT "Number4", Number4
FROM tblNoNameGiven
UNION
SELECT "Number5", Number5
FROM tblNoNameGiven
UNION
SELECT "Number6", Number6
FROM tblNoNameGiven
ORDER BY 2
;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top