|
-
October 26th, 2008, 05:58 PM
#1
[RESOLVED] access problem
Hi, i have table with column that takes country name else it takes "other" value my question is how i can retrieve rows grouped by country name and the rows with country name equal to "other" are in the end of selection
-
October 27th, 2008, 05:15 AM
#2
Re: access problem
 Originally Posted by ledaker
Hi, i have table with column that takes country name else it takes "other" value my question is how i can retrieve rows grouped by country name and the rows with country name equal to "other" are in the end of selection
Easiest way would probably be
Code:
SELECT *
FROM tableA
WHERE columnA <> 'Other'
ORDER BY columnA asc
UNION
SELECT *
FROM tableA
WHERE columnA = 'Other';
Sincerely,
Martin Svendsen
-
October 27th, 2008, 11:23 AM
#3
Re: access problem
Hi all.
This query doesn't work beacause you cannot add the ORDER BY clause into UNION. Probably there isn't a way to get what ledaker wants using only a query.
-
October 27th, 2008, 03:34 PM
#4
Re: access problem
 Originally Posted by davide++
Hi all.
This query doesn't work beacause you cannot add the ORDER BY clause into UNION. Probably there isn't a way to get what ledaker wants using only a query.
davide++ has reason this query doesnt work, please other solution
-
October 28th, 2008, 03:01 AM
#5
Re: access problem
Sorry, you're right, try this instead
Code:
SELECT *, '1' AS OrderBy
FROM tableA
WHERE columnA <> 'Other'
UNION
SELECT *, '2' AS OrderBy
FROM tableA
WHERE columnA = 'Other'
ORDER BY OrderBy ASC;
Just note that you'll get the extra field out "OrderBy" with values '1' or '2'.
Sincerely,
Martin Svendsen
-
October 28th, 2008, 05:22 AM
#6
Re: access problem
thank you
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|