摘要:
从数据库中读取数据:使用DataReader对象从数据库中读取数据首先需要添加几个命名空间1 //需要添加的命名空间2 using System.Configuration;3 using System.Data;4 using System.Data.SqlClient;配置文件如下1 2 ... 阅读全文
摘要:
假设有两个表结构如下:表table1表 table 2内连接:--内连接select * from table1 inner join table2 on table1.ID = table2.ID 结果:左外连接:--左连接select * from table1 left join table2 on table1.ID = table2.ID结果:右外连接:--右连接select * from table1 right join table2 on table1.ID = table2.ID 结果:全连接:select * from table1 full join table2 on. 阅读全文
摘要:
1:编写Sql语句,查询id重复3次以上的条目,表为Pram(id,name)先看建立的表:SQL语句: 直接使用一个子查询即可select * from Pramwhere id in(select id from Pramgroup by idhaving COUNT(id)>3) 结果: 阅读全文
摘要:
SELECT TOP 10 SalesOrderID, SalesOrderID % 10 AS 'Last Digit',-- 求最后一位的值 Position = CASE SalesOrderID % 10 WHEN 1 THEN 'First' WHEN 2 THEN 'Second' WHEN 3 THEN 'Third' WHEN 4 THEN 'Fourth' ELSE 'Something Else' ENDFROM Sales.SalesOrderHeader 阅读全文