Rate this:
See more:
Hi Friends,

I have a Currency table with records as follows :

ID Name
1 INR
2 USD
3 SGD
4 EURO
. .
. .

When I fire a query like, `select * from Currecny`, I get the recordset as shown.

But I want to get " SGD " as my first record, then all remaining records.

How can I get this?

Any help appreciated.

Thanks,
Lok.
Posted 22-Dec-11 18:22pm
Edited 22-Dec-11 19:47pm
RaisKazi32.9K
v2

Rate this:

## Solution 3

```select * from currency
order by
case name
when 'SGD' then 1
else 2
end
```
Amir Mahfoozi at 23-Dec-11 4:36am

+5 Another good solution.
Scubapro at 23-Dec-11 4:38am

Tnx!
Rate this:

## Solution 2

Amir's answer is enough but here alternative solution
Add an another column in your table(Ex. Default or DisplayOrder), see below table.
```ID Name IsDefault
-----------------
1 INR   N
2 USD   N
3 SGD   Y
4 EURO  N```
Use the Below Query
`SELECT * FROM [Table] ORDER BY SGD DESC`
```ID Name DisplayOrder
-----------------
1 INR   2
2 USD   3
3 SGD   1
4 EURO  4```
`SELECT * FROM [Table] ORDER BY DisplayOrder`
Amir Mahfoozi at 23-Dec-11 1:05am

+5 Yes, I always use display order in my own projects :)
rks0191@gmail.com at 15-Oct-13 5:22am

nice one :)
RaviRanjankr at 23-Dec-11 1:36am

5+
Rate this:

## Solution 1

Try this :
```select * from currency where id=3
union all
select * from color where id<>3```
thatraja at 23-Dec-11 1:02am

5!
RaviRanjankr at 23-Dec-11 1:36am

My 5+
LokeshZende at 23-Dec-11 3:11am

Thanks Amir... :)
Amir Mahfoozi at 23-Dec-11 4:27am

You're welcome :)