Custom Order

  • Thread starter Thread starter Saber Soleymani
  • Start date Start date
S

Saber Soleymani

Hello,
I've a table like this:
ID - PartNo
-------------
1 a
2 b
3 c
4 d

I pass a query to access (through ASP.Net) like this:
SELECT *
FROM tbl
Where PartNo In
('d','a','c')

The result is:
a
c
d
records.
but I expect this order:
d
a
c

How can I customize order query?
Something like this imaginary query:
Select * From tbl Where PartNo In ('d','a','c') Order By
PartNo('d',;a','c')!!!
 
Found that:

SELECT *
FROM tbl
Where PartNo In
('d','a','c')
order by PartNo='d',PartNo='a',PartNo='c'
 
Back
Top