Re: order by mod(right(x,1),2) as odd/even

From: Luuk <luuk_at_invalid.lan>
Date: Thu, 21 Mar 2019 21:31:18 +0100
Message-ID: <5c93f499$0$22364$e4fe514c_at_news.xs4all.nl>


On 20-3-2019 04:14, vjp2.at_at_at.BioStrategist.dot.dot.com wrote:

> THis doesn't seem to work
> I tried trim() and Cast(.. as signed)
> no luck
> 
> 

Can you say what is not working?

[root_at_(none)]> select '1' as x union select '2' union select '3' union select '4' ;
+---+
| x |

+---+
| 1 |
| 2 |
| 3 |
| 4 |

+---+
4 rows in set (0.00 sec)

[root_at_(none)]>
[root_at_(none)]> select '1' as x union select '2' union select '3' union select '4' order by mod(right(x,1),2) ;
+---+
| x |

+---+
| 2 |
| 4 |
| 1 |
| 3 |

+---+
4 rows in set (0.00 sec)

-- 
Luuk
Received on Thu Mar 21 2019 - 21:31:18 CET

Original text of this message