php - database reading
迷茫
迷茫 2017-05-16 13:15:20
0
3
405

It is known that the database has a table called dati, and a field title format is varchar, and the stored content is Chinese sentences of different lengths. How should it be written to output long sentences first and then short sentences? ?
I can’t achieve it by using select *from dati order by title! Ask God for help

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(3)
阿神

SELECT * FROM dati ORDER BY LENGTH(title) DESC

The length of a string can also be calculated in MySQL. First calculate the length of the string, and then arrange it backwards according to the length, and you can achieve it

为情所困

select *from dati order by length(title);

仅有的幸福

Arranged in descending order by length

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template