select top 10 db_product.h_id
from (select * from db_product
where h_id not in(
select top 10 db_product.h_id
from db_product,
db_publishs,
db_product_discount
where db_product.pub_id=db_publishs.pub_id
AND db_product.h_id=db_product_discount.h_id
AND db_product.h_type='0707'))这是一个分页语句。在查询分析器里执行时为什么提示:"服务器: 消息 170,级别 15,状态 1,行 10
第 10 行: ')' 附近有语法错误。"
from (select * from db_product
where h_id not in(
select top 10 db_product.h_id
from db_product,
db_publishs,
db_product_discount
where db_product.pub_id=db_publishs.pub_id
AND db_product.h_id=db_product_discount.h_id
AND db_product.h_type='0707'))这是一个分页语句。在查询分析器里执行时为什么提示:"服务器: 消息 170,级别 15,状态 1,行 10
第 10 行: ')' 附近有语法错误。"
from (select * from db_product
where h_id not in(
select top 10 db_product.h_id
from db_product,
db_publishs,
db_product_discount
where db_product.pub_id=db_publishs.pub_id
AND db_product.h_id=db_product_discount.h_id
AND db_product.h_type='0707')) as t
from (select * from db_product b
where b.h_id not in(
select top 10 db_product.h_id
from db_product,
db_publishs,
db_product_discount
where db_product.pub_id=db_publishs.pub_id
AND db_product.h_id=db_product_discount.h_id
AND db_product.h_type='0707')) a這樣試試?你那樣表裡有表又不使用別明,內表的h_id都無法識別
from (select * from db_product
where h_id not in(
select top 10 db_product.h_id
from db_product,
db_publishs,
db_product_discount
where db_product.pub_id=db_publishs.pub_id
AND db_product.h_id=db_product_discount.h_id
AND db_product.h_type='0707'))a
用not in速度太慢,
如果你数据量不大的话,那无所谓