日期:2014-05-18 浏览次数:20525 次
姓名 年龄 金额 张小姐 20 121 李小姐 25 254 陈小姐 30 365
USE tempdb create table mytest ( [name] nvarchar(10), age int, price numeric(12) ) insert into mytest([name],age,price) values ('张小姐','20','121') insert into mytest([name],age,price) values ('李小姐','25','254') insert into mytest([name],age,price) values ('陈小姐','30','365') select * from mytest where age <=25 SELECT sum(price) as valprice from mytest where age <=25 /* 375 */