请详细解释一下这个查询语句:select top ××× as ×××

来源:百度知道 编辑:UC知道 时间:2024/05/31 07:07:52
select top 10 TypeName,sum(TotalPrice) as TotalPrice,yName from tb_Sell where itType=2 and yName in (select yName from tb_MedicineName) group by TypeName,yName order by TotalPrice desc

请解释下这条语句,谢谢。关键是里面的as是怎样用的。
我如果还想得到yName记录对应的tb_Sell中的Id应该怎样改呢?

你确定你写的这句话是正确的吗?

从表tb_Sell 中查询满足条件itType=2和yName in (select yName from tb_MedicineName) 的TypeName,sum(TotalPrice) as TotalPrice,yName并按TotalPrice降序排列的前10条记录
其中yName in (select yName from tb_MedicineName)表示需要满足的条件2的yName必须在表tb_MedicineName中查询的yName值中
sum(TotalPrice) as TotalPrice表示对TotalPrice字段聚合求其总和并做为一个新的字段TotalPrice输出

select top 10 TypeName,id,sum(TotalPrice) as TotalPrice,yName from tb_Sell where itType=2 and yName in (select yName from tb_MedicineName) group by TypeName,yName order by TotalPrice desc

这里AS是帮你合计出来字段起个名字

请详细解释一下这个查询语句:select top ××× as ××× 请帮忙解释一下这个韩国语句子! 6.请把这个数据库spl语句详细解释一下,明天老师要讲解,讲的对就给分 10.请把这个数据库spl语句详细解释一下,明天老师要讲解,讲的对就给分 9.请把这个数据库spl语句详细解释一下,明天老师要讲解,讲的对就给分 33.请把这个数据库spl语句详细解释一下,明天老师要讲解,讲的对就给分 3.请把这个数据库spl语句详细解释一下,明天老师要讲解,讲的对就给分 88.请把这个数据库spl语句详细解释一下,明天老师要讲解,讲的对就给分 8.请把这个数据库spl语句详细解释一下,明天老师要讲解,讲的对就给分 帮忙解释一下这个语句