SQL顺序和查询结果的限制

时间:2016-01-08 15:08:33

标签: mysql sql

我有一个查询,按列a 排序行,并且限制为100.然后我想对该结果运行一个查询,该查询按 b列排序行并限制在50岁之内。

我该怎么做?

2 个答案:

答案 0 :(得分:3)

在派生表中执行第一个order by / limit。然后在派生表的结果上执行第二个order by / limit

select * from
(
select * from tablename
order by a
limit 100
) dt
order by b
limit 50

答案 1 :(得分:0)

您应该使用Protected Sub EPACheck_Clicked(ByVal sender As Object, ByVal e As EventArgs) Dim ckbx As CheckBox = CType(sender, CheckBox) Dim dgItem As DataGridItem = CType(ckbx.NamingContainer, DataGridItem) Dim rcDelete As String = dgItem.ItemIndex CType(Session("mytable"), DataTable).Rows.RemoveAt(Convert.ToInt32(rcDelete)) BindgrdEPA() End Sub 声明:

select from select