CREATE TABLE TBA ( age int, name nvarchar(50) ) INSERT INTO TBA select '20','张三' union all select '21','里斯' union all select '31','王五' union all select '42','赵六' union all select '42','周武' union all select '39','杨八' union all select '52','李四' select top 5 * from TBA order by age descage name ----------- -------------------------------------------------- 52 李四 42 周武 42 赵六 39 杨八 31 王五(5 行受影响)
set rs=Server.CreateObject("ADODB.Recordset") rs.open "select top 5 * from link order by tin desc",conn,1,1 if not rs.eof then for i=1 to rs.recordcount response.write rs("title")&"<br/>" rs.movenext next end if rs.close set rs=nothing 我用的access+asp,确实会显示6条数据,麻烦你看下问题出在哪里?谢谢
不知道access行不行,你的问题主要是*号--CREATE TABLE TBA --( --age int, --name nvarchar(50) --) --INSERT INTO TBA --select '20','张三' union all --select '21','里斯' union all --select '31','王五' union all --select '42','赵六' union all --select '42','周武' union all --select '39','杨八' union all --select '52','李四'
SELECT * FROM tba a WHERE EXISTS ( SELECT 1 FROM ( SELECT TOP 5 age FROM tba ) b WHERE a.age = b.age )
(
age int,
name nvarchar(50)
)
INSERT INTO TBA
select '20','张三' union all
select '21','里斯' union all
select '31','王五' union all
select '42','赵六' union all
select '42','周武' union all
select '39','杨八' union all
select '52','李四' select top 5 * from TBA order by age descage name
----------- --------------------------------------------------
52 李四
42 周武
42 赵六
39 杨八
31 王五(5 行受影响)
rs.open "select top 5 * from link order by tin desc",conn,1,1
if not rs.eof then
for i=1 to rs.recordcount
response.write rs("title")&"<br/>"
rs.movenext
next
end if
rs.close
set rs=nothing
我用的access+asp,确实会显示6条数据,麻烦你看下问题出在哪里?谢谢
--(
--age int,
--name nvarchar(50)
--)
--INSERT INTO TBA
--select '20','张三' union all
--select '21','里斯' union all
--select '31','王五' union all
--select '42','赵六' union all
--select '42','周武' union all
--select '39','杨八' union all
--select '52','李四'
SELECT *
FROM tba a
WHERE EXISTS ( SELECT 1
FROM ( SELECT TOP 5
age
FROM tba
) b
WHERE a.age = b.age )