如何通过访问excel将查询导出到两列。我需要将20条记录发送到B列,将接下来的20条记录发送到E列。我已经阅读了LIMIT和TOP,以及有关子查询的内容,我似乎并没有这样做。
我已经看过这种类型的东西了:但说实话,我真的不会这样做。但是,它似乎会将记录从第250行返回到300.我不确定如何将其转换为VBA中的查询。
SELECT *
FROM (SELECT TOP 50 tab2.*
FROM (SELECT TOP 300 tab1.*
FROM my_table AS tab1
ORDER BY column_name ASC) AS tab2
ORDER BY column_name DESC)
ORDER BY column_name ASC;
这是更新,这给了我一列有前20条记录,下一列有最后20条记录,但后退。
SQLActiveTop = "SELECT TOP 20 TblMembers.LastName, TblMembers.FirstName, TblMembers.Status, [FirstName] & "" "" & [LastName] AS FullName " & _
"FROM TblMembers " & _
"WHERE (((TblMembers.Status) = 'Active')) " & _
"ORDER BY TblMembers.LastName ASC;"
SQLActiveBottom = "SELECT TOP 20 TblMembers.LastName, TblMembers.FirstName, TblMembers.Status, [FirstName] & "" "" & [LastName] AS FullName " & _
"FROM TblMembers " & _
"WHERE (((TblMembers.Status) = 'Active')) " & _
"ORDER BY TblMembers.LastName DESC;"