asp+acess两个表 联合查询

来源:百度知道 编辑:UC知道 时间:2024/07/04 10:07:25
一:class 要查字段:NumberID
二: product 表中的字段:Market_Price
根据价格 查询木一分类下符合条件的 产品
sql = "Select class,product From class.NumberID left join product.Market_Price on class.NumberID=product.Market_Price where class.NumberID = '"& SearchClass &"' and product.Market_Price >="&smake&" and product.Market_Price <= "&emake&" order by id desc"

很不明白你的class.NumberID怎么会等于prodct.Market_Price

不过猜测你的意思是根据一个ID和一个价格范围查询这两个表的信息
我不太擅长连接查询 用子查询来试试
select c.NumberID,p.Market_Price from class as c ,product as p
where c.NumberID = "&SearchClass&" and p.Market_Price between "&smake&" and "&emake&"

表结构
要不不好写sql