我想从表中检索具有image_type
和priority
等字段的记录。使用SQL查询检索记录
像
property id image_type priority
1 1 1
1 0 1
1 1 2
1 0 2
1 0 3
我想告诉像所有的图像类型Records唱片公司走到一起&按照优先顺序或者ASC
或DESC
安排。
我想从表中检索具有image_type
和priority
等字段的记录。使用SQL查询检索记录
像
property id image_type priority
1 1 1
1 0 1
1 1 2
1 0 2
1 0 3
我想告诉像所有的图像类型Records唱片公司走到一起&按照优先顺序或者ASC
或DESC
安排。
SELECT
*
FROM
undefined_table_name
GROUP BY
image_type
ORDER BY
image_type ASC;
使用ORDER BY
:
SELECT `property id`, `image_type`, `priority`
FROM `your_table`
ORDER BY `image_type`, `priority` DESC
你希望他们通过priority
(ASC)排序,然后按image_type
(DESC),所以你会做这样的:
SELECT `property id`, `image_type`, `priority`
FROM `your_table`
ORDER BY `priority`, `image_type` DESC
灿你显示你想看到的输出? – 2012-02-28 09:23:43