Order by datetime列SQLite [英] Order By datetime column SQLite

查看:38
本文介绍了Order by datetime列SQLite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个具有datetime列的sqlie数据库,我以"yyyy-MM-dd HH:mm"格式存储了datetime列的值,但是当我想从数据库中选择值并按datetime列排序时,这给了我错误的订单.

I'm using a sqlie database wich have a datetime column, i stored values of the datetime column with format "yyyy-MM-dd HH:mm" but when i want to select values from Database and order by the datetime column, it gives me a wrong order.

SELECT id_user FROM RDV WHERE id_user= ? ORDER BY datetime(Date) DESC

我添加了datetime(Date)只是为了检查它是否可以正常工作,但是它也不能正常工作

i added datetime(Date) just to check if it works but it didn't work also

推荐答案

我最终犯了一个错误,tha的日期格式为"dd-MM-yyyy HH:mm",我必须将其格式为yyyy-MM-dd高度:毫米

Acually i made in error, tha dates where in format "dd-MM-yyyy HH:mm" and i must put them in format yyyy-MM-dd HH:mm

这篇关于Order by datetime列SQLite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆