作者kero961240 (kobe)
看板Database
標題[SQL ] SQL 多個複雜查詢串接問題
時間Fri Mar 11 23:59:47 2022
資料庫名稱: SQL SERVER
資料庫版本: 2016
內容/問題描述:
各位前輩好,小弟目前在工作上遇到此需求
現在有一個 TABLE tbStudent
當中的三個欄位 name chinese math
小弟想拉出 name = a chinese = 90 math = 80
name = b chinese = 78 math = 96
請問語法該如何串接呢
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 223.139.208.242 (臺灣)
※ 文章網址: https://webptt.com/m.aspx?n=bbs/Database/M.1647014389.A.1A3.html
1F:→ Iories: where name+chinese+math in ('a9080','b7896') 03/12 07:29
2F:→ Iories: 若有型別問題再用convert轉換一下 03/12 07:30
3F:→ MOONY135: .....工作上這樣用嗎.... 03/14 09:48
4F:推 alpho: 用TVP join 試試看? 03/22 10:38
5F:→ alec65: select name,chinese=Max(chinese),math=Max(math) from 03/22 11:04
6F:→ alec65: tbStudent group by name 03/22 11:04
7F:→ vul81320: 奇怪..只有我看不懂你的条件到底是什麽吗? 05/23 11:51