标签:ldb har scores rdb 查询 core exists manager .class
1 use StudentManager 2 go 3 --判断视图是否存在 4 if exists(select * from sysobjects where name=‘view_ScoreQuery‘) 5 drop view view_ScoreQuery 6 go 7 --创建视图 8 create view view_ScoreQuery 9 as 10 select top 1000 Students.StudentId,StudentName,ClassName, 11 C#=CSharp,SQLDB=SQLServerDB, 12 ScoreSum=(CSharp+SQLServerDB) from Students 13 inner join ScoreList on Students.StudentId=ScoreList.StudentId 14 inner join StudentClass on Students.ClassId=StudentClass.ClassId 15 order by StudentClass.ClassId 16 go 17 --使用视图查询 18 select * from view_ScoreQuery
视图里面如果想用order by 排序,必须要加入top,所以视图里不建议加order by ,想要加order by 建议在调用视图的时候加
标签:ldb har scores rdb 查询 core exists manager .class
原文地址:https://www.cnblogs.com/Spinoza/p/10049155.html