是否有人知道如何在下面的陈述中插入订单
SELECT ctr_num,
scn
FROM user_convoy
WHERE ctr_num LIKE '%" + str_convoy + "%'"
答案 0 :(得分:2)
不确定你的问题,但根据我的理解,它应该是:
select ctr_num , scn from user_convoy where ctr_num like '%" + str_convoy + "%'" ORDER BY your_column
答案 1 :(得分:1)
最后添加ORDER BY。 SELECT语句的一般格式通常是SELECT FROM WHERE ORDER BY(当然假设没有分组)。请注意,它不区分大小写。
select ctr_num , scn from user_convoy where ctr_num like '%' + str_convoy + '%' ORDER BY ctr_num
答案 2 :(得分:1)
ORDER BY关键字用于按一列或多列对结果集进行排序。
如果您想使用Order By,请尝试以下。
SELECT ctr_num,
scn
FROM user_convoy
WHERE ctr_num LIKE '%' + str_convoy + '%'
ORDER BY
ctr_num,scn
更多详情:
请参阅w3schools Example并深入了解 this