如何为每个 id_ope 获取数据库的第一个值?
How I can get first value of database for each id_ope?
当 id_ope 更改时,我的第一行数据丢失
当我从数据库中查询数据时,它显示如下
编码后
这是我在 ASP-classic
中的代码
test = 0
for x = 0 to emailRow
id_ope = arrx(0,x)
id_boat = arrx(1,x)
bname = arrx(2,x)
' email = arrx(3,x)
body = "<table>"&arrcon&"<table>"
if id_ope&"" <> "2" then
if test = 0 then
test = id_ope
content = "<tr><td>"&bname&id_ope&"</td><td>"&id_boat&"</td></tr>"
arrcon = arrcon +content
elseif test = id_ope then
content = "<tr><td>"&bname&id_ope&"</td><td>"&id_boat&"</td></tr>"
arrcon = arrcon +content
else
content = "<tr><td>"&bname&id_ope&"</td><td>"&id_boat&"</td></tr>"
arrcon = arrcon +content
mailBody = body
arrcon = ""
test = id_ope
response.write mailBody
end if
end if
next
这是我的 SQL 查询
SELECT DISTINCT TOP 30 boat.id_ope,
boat.id_boat,
boat.Name2
FROM Boat
INNER JOIN Commission ON Commission.id_boat = Boat.id_boat
WHERE Commission.Commission = '0'
ORDER BY boat.id_ope DESC;
见评论码
content = "<tr><td>"&bname&id_ope&"</td><td>"&id_boat&"</td></tr>"
arrcon = arrcon +content // add value
mailBody = body
arrcon = "" //set = null
test = id_ope
response.write mailBody
我认为你的设置 arrcon = "" 在添加值后
当 id_ope 更改时,我的第一行数据丢失 当我从数据库中查询数据时,它显示如下
编码后
test = 0
for x = 0 to emailRow
id_ope = arrx(0,x)
id_boat = arrx(1,x)
bname = arrx(2,x)
' email = arrx(3,x)
body = "<table>"&arrcon&"<table>"
if id_ope&"" <> "2" then
if test = 0 then
test = id_ope
content = "<tr><td>"&bname&id_ope&"</td><td>"&id_boat&"</td></tr>"
arrcon = arrcon +content
elseif test = id_ope then
content = "<tr><td>"&bname&id_ope&"</td><td>"&id_boat&"</td></tr>"
arrcon = arrcon +content
else
content = "<tr><td>"&bname&id_ope&"</td><td>"&id_boat&"</td></tr>"
arrcon = arrcon +content
mailBody = body
arrcon = ""
test = id_ope
response.write mailBody
end if
end if
next
这是我的 SQL 查询
SELECT DISTINCT TOP 30 boat.id_ope,
boat.id_boat,
boat.Name2
FROM Boat
INNER JOIN Commission ON Commission.id_boat = Boat.id_boat
WHERE Commission.Commission = '0'
ORDER BY boat.id_ope DESC;
见评论码
content = "<tr><td>"&bname&id_ope&"</td><td>"&id_boat&"</td></tr>"
arrcon = arrcon +content // add value
mailBody = body
arrcon = "" //set = null
test = id_ope
response.write mailBody
我认为你的设置 arrcon = "" 在添加值后