08-28-15, 13:21 #1Registered User
- Join Date
- Aug 2015
Answered: ORDER BY - After Hyphen/decimal - HELP NEEDED!!
select sum(woitem.qtytarget) as total, wo.num, sysuser.username
ON wo.id = woitem.woid
on moitem.id = woitem.moitemid
ON mo.id = moitem.moid
LEFT JOIN SYSUSER ON mo.userid = sysuser.id
group by sysuser.username, num
order by wo.num Asc
wo.num starts with 1000:001, 1001:001, 1002:001......999:001, 998:001, 99:001
But I need an order with displays 1:001, 2:001, 3:001,.....999:001, 1000:001, 1001:001, 1002:001
Last edited by prettyricky; 08-28-15 at 13:23. Reason: Spelling mistake in title - HELP NEEDED in order by
"So it is a car or a varchar field and you want to sort it like a integer? If so use SUBSTRING to split out the values to the left and right of the colon and then cast those values as integers, and then sort by those 2 values.This solution is not guaranteed to be very efficient."
08-28-15, 14:09 #2Annie's Dog Walker
Provided Answers: 6
- Join Date
- Nov 2004
- on the wrong server
So it is a car or a varchar field and you want to sort it like a integer? If so use SUBSTRING to split out the values to the left and right of the colon and then cast those values as integers, and then sort by those 2 values.This solution is not guaranteed to be very efficient.If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry. Earnest Hemingway, A Farewell To Arms.