首页 > 技术文章 > 几个简单常用的Sql语句

xinchenhui 2017-11-17 22:49 原文

select SUM(Gnumber) as Ids from Goods where Cids = '2';
--查Cids为2的Gnumber列的和,列名为Ids
select Cids,Plevel from People;
select * from Salary;
select * from Salary,People where People.Plevel = Salary.Slevel;
--查Salary,People两个表
select SUM(Ssalary) as salary from Salary,People where People.Plevel = Salary.Slevel and Cids = '2';
--合并Salary,People,查Cids为2的Ssalary列的和,列名为salary

 

推荐阅读