Select Statement的问题〜有人可以帮忙吗? [英] Problem With Select Statement ~ Can anyone Help?

查看:60
本文介绍了Select Statement的问题〜有人可以帮忙吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All,


我有这个sql语句,当我调用一个函数时它在MSSQL中工作


函数showNewProd(dispNum)


''声明一些变量

dim mySQL,rsTemp,tempStr,count


''读取数据库

mySQL =" SELECT TOP" &安培;差异与分析" idProduct,description" _

& FROM products _

& WHERE active = -1; _

& ORDER BY idProduct DESC

set rsTemp = openRSexecute(mySQL)

do while while rsTemp.EOF


' '增量计数器

count = count + 1


''构建显示字符串

tempStr = tempStr _

&数数与数量" ;. < a href =""" &安培; urlNonSSL _

& " prodView.asp idProduct = QUOT; &安培; rsTemp(" idProduct")& """>" _

& rstemp(" description")_

& "< / a>< br>"


''下一个记录

rsTemp.MoveNext


循环

调用closeRS(rsTemp)

结束函数

我需要使用与mysql数据库相同的函数,我b / b
有问题可能是SELECT TOP语句,没有工作

与MYSQL,但我不知道如何解决这个问题,任何人都可以提供帮助我是一个

有点卡住了。


非常感谢提前。

Andie

Hello All,

I have this sql statement thats works in MSSQL when I call a function

function showNewProd(dispNum)

''Declare some variables
dim mySQL, rsTemp, tempStr, count

''Read Database
mySQL="SELECT TOP " & dispNum & " idProduct, description " _
& "FROM products " _
& "WHERE active = -1 " _
& "ORDER BY idProduct DESC "
set rsTemp = openRSexecute(mySQL)
do while not rsTemp.EOF

''Increment counter
count = count + 1

''Build display string
tempStr = tempStr _
& count & ". <a href=""" & urlNonSSL _
& "prodView.asp?idProduct=" & rsTemp("idProduct") & """>" _
& rstemp("description") _
& "</a><br>"

''Next Record
rsTemp.MoveNext

loop
call closeRS(rsTemp)

end function
I need to make the same function work with a mysql database, the problem I
am having is a problem with possibly the SELECT TOP statement, not working
with MYSQL but I am not sure how to fix this, can anyone help as I am a
little stuck.

Many thanks in advance.
Andie

推荐答案

Andie写道:
Andie wrote:
我需要使用相同的函数与mysql数据库一起工作,我所拥有的问题是可能是SELECT TOP语句的问题,没有与MYSQL一起工作但是我不知道如何解决这个问题,任何人都可以提供帮助,因为我很少被卡住。
I need to make the same function work with a mysql database, the problem I
am having is a problem with possibly the SELECT TOP statement, not working
with MYSQL but I am not sure how to fix this, can anyone help as I am a
little stuck.




SELECT TOP有什么作用? (或者它应该在MySQL中做什么?)



What does SELECT TOP do? ( Or what it is supposed to do in MySQL? )


Andie写道:
Andie wrote:
我需要做同样的功能工作使用mysql数据库,我遇到的问题是可能是SELECT TOP语句的问题,不能与MYSQL一起工作但我不知道如何解决这个问题,任何人都可以提供帮助,因为我是<很少卡住。
I need to make the same function work with a mysql database, the problem I
am having is a problem with possibly the SELECT TOP statement, not working
with MYSQL but I am not sure how to fix this, can anyone help as I am a
little stuck.




SELECT TOP有什么作用? (或者它应该在MySQL中做什么?)



What does SELECT TOP do? ( Or what it is supposed to do in MySQL? )


感谢您的快速回复..


基本上当我添加一个产品到数据库,产品被添加到

数据库,idproduct字段是一个递增的文件。


功能以相反的顺序对文件进行排序idproduct并显示

最后(比如5)记录产品添加到数据库中。


希望这会有所帮助。


Andie
Thanks for the quick response..

Basically when I add a product to the database, the product is added to the
database with the idproduct field being an incremented file.

The fuction sorts the file in reverse order of idproduct and displays the
last (say 5) record products added to the database.

Hope this helps.

Andie


这篇关于Select Statement的问题〜有人可以帮忙吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆