一个innerjoin就解决了,你可以参考下sqlserver的文档,里面有源码实例的。
- 情感问答
- 答案列表
多表查询sql语句:sql多表查询格式[朗读]
--楼主我帮你写吧--有什么疑问可以随时找我希望采纳declare@idec(12,2)declare@jdec(12,2)select@i=scorefromaselect@j=sum(score)from(selectscorefrom?
一使用select子句进行多表查询select字段名from表1,表2…where表1.字段=表2.字段and其它查询条件selecta.id,a.name,a.address,a.date,b.math,b。
selectt1fromawherea.t2in(selectu1fromb)anda.t3in(selectu1fromb)a.t4in(selectu1fromb)。
那就写个存储过程,然后再在存储过程里面写多表联结查询的sql语句喽~下面是创建存储过程的关键字:createproc存储过程名称asbegin//多表联结查询的sql语句endgoexec存储过程名称希望我的回答对你有所帮助,谢谢采纳。