SQL语句 求大家告诉我一下语法

[复制链接]
查看11 | 回复4 | 2011-3-2 15:45:37 | 显示全部楼层 |阅读模式
Dim sql2 As String = "select top 5 * from(( shouyeliuyan inner join usertable on shouyeliuyan.shouyeliuyan_liuyanren=usertable.username) inner join hfsyly on shouyeliuyan.shouyeliuyan_ID=hfsyly.liuyanID) where ( not in (select top " & (AspNetPager1.CurrentPageIndex - 1) * 5 & " shouyeliuyan_ID from shouyeliuyan order by shouyeliuyan_ID desc)) and ( shouyeliuyan_shouyeID=" & ID & " ) order by shouyeliuyan_ID desc"
呵呵 有点长
access数据库
不过就一个地方不行
在WHERE NOT IN ( SELECT 语句)and shouyeliuyan_shouyeID=XX
这里怎么连接
求大家告诉我一下语法
1L我加了 但是还是不行
内联了的SQL语句怎么用NOT IN

回复

使用道具 举报

千问 | 2011-3-2 15:45:37 | 显示全部楼层
where什么not in啊,要把字段写上去比如id not in (select xxxxx) 就是说取id中不属于查询结果的部分
回复

使用道具 举报

千问 | 2011-3-2 15:45:37 | 显示全部楼层
IN用法SELECT NAME FROM TABWHERE ID NOT IN(select 语句)你的where后面少了对应的字段,
回复

使用道具 举报

千问 | 2011-3-2 15:45:37 | 显示全部楼层
Dim sql2 As String = "select top 5 * from shouyeliuyan inner join usertable on shouyeliuyan.shouyeliuyan_liuyanren=usertable.username inner join hfsyly on shouyeliuyan.shouyeliuyan
回复

使用道具 举报

千问 | 2011-3-2 15:45:37 | 显示全部楼层
以后写程序要规范点,你这个有点乱,
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行