Custom Order

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')!!!
 
S

Saber Soleymani

Found that:

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

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