您的位置:首页 > 数据库

sql语句学习贴,不断更新!

2007-01-15 16:33 288 查看
1. select between用法:

分类id在7和9之间的:
SelectCommand="SELECT top 8 [id], [Clid], [Title], [TitleColor], [Ontop], [Hot], [AddTime] FROM [Article] WHERE [Clid] between 7 and 9 ORDER BY [Ontop], [Hot], [id] desc"
分类id不在7和9之间的:
SelectCommand="SELECT top 8 [id], [Clid], [Title], [TitleColor], [Ontop], [Hot], [AddTime] FROM [Article] WHERE [Clid] not between 7 and 9 ORDER BY [Ontop], [Hot], [id] desc"

2. 同一个select语句获得两个表的内容:

1select A.OrderNum,A.Product_Id,A.BuyPrice,A.ProdUnit,C.Title,C.Buy_Price from OrderDetail A,Products C where A.OrderNum='"&id&"' and A.Product_Id=C.Product_Id"
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: