使用下面的数据,我如何打印出ID 5不应按顺序降序排列。我如何按照我想要的顺序实际读取列值?
Id Value
1 5000
2 82 900
3 81 000
4 80 000
5 79 000
答案 0 :(得分:0)
尝试
降序 base_query = Table.objects.order_by('-created_at')
pk_to_be_deleted = remove_duplicate_based_on_date(base_query)
base_query.filter(id__in=pk_to_be_deleted).delete()
升序 SELECT * FROM table_name ORDER BY column_name DESC
答案 1 :(得分:0)
在Sql中,
SELECT column_name,column_name FROM table_name ORDER BY column_name ASC | DESC,column_name ASC | DESC;
此查询可以下降或提升列并获取值