How to get sequential records from database using IN statement?
I have below query which getting records with mismatched order by using IN statement.By execution of below query i got following type of result,
"SQL">SELECT patient_name , AGE , patient_gender , pd.mrd_number , Item_Desc , item_id , pd.pID, Pending_Qty
FROM vw_DSInfo_prescription_master pm
INNER JOIN vw_DSInfo_prescription_details pd
ON pm.mrd_number = pd.mrd_number
WHERE pm.pID = pd.pre_ID
AND pd.pre_ID IN ('1964920','1965969','1964583','1965139','1965959')
AND pm.mrd_number = 12345
AND pd.Pending_Qty NOT like '0%'
AND Pending_qty NOT LIKE '-%';
By execution of below query i got following type of result,
1. 1st 4 rows of pre_Id 1964583
2. 2nd 2 rows of pre_Id 1964920
3. 3rd 3 rows of pre_Id 1965969
4. 4th 5 rows of pre_Id 1965139
5. 5th 7 rows of pre_Id 1965959
this order is mismatched and sorted by datetime but i define this order (1964920.1965969,1964583,1965139,1965959) in 'IN' statement and i want all rows by defined order only.