Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IN () and ORDER by IN ()

Status
Not open for further replies.

miguel11

Programmer
May 24, 2001
8
PE
is it possible order by IN, how can I do it? each time I try this way, the order

is ascendent and ordered by items_id, I want It keeps the items_id_list order,
any idea?

"SELECT * FROM items WHERE items_id IN (" & items_ID_List & ") ORDER BY IN (" &

items_ID_List & ")"


thanks in advance

Miguel
 
The IN is a test for membership--you can't sort on the test function. If you use

ORDER BY [items_id]

you'll get what you want--items id is the field that will hold the results returned from the test.

O sea que una vez determinada la lista, despues de la prueba "IN," puedes ordenarla por medio de ORDER BY los resultados :-}
 
gracias por tu consejo quehay pero lo que yo deseo es
mantener el orden de la cadena items_id_list, o sea que si
en la cadena esta 3,9,1,13 el orden del recordset sea el mismo o sea primero el 3, segundo el 9 y asi.
Aun trabajando en ello
Miguel
 
What determines the original order? Is there a date of entry or something similar? If the order of the items is meaningful there must be a way of indicating their sequence, even if that means putting a "TimeEntered" field in the table with a default value of Now().
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top