看板 Database 關於我們 聯絡資訊
select a.store_name,b.area,max(a.sales) as sales from a inner join b on a.store_name=b.store_name group by a.store_name,b.area 這應該是你要的吧? -- ▃▅▇▆▄ ▆▂▃ ` 逝去感如何能留住,半點遺留殊不易,██▅▇▄▃ ▇▃▂" . █████████▃i ▁▄▇ 更多悽悽慘慘的遭遇………██▆▃ █▅▆▃ˍ▄* ▂█▄▇▅▂. 我不知道,王~八~蛋~~! ▂▆███ █▄▃ 。fumizuki。Check。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.184.116.37
agogoman:不是耶,我想取A表格SALES最多的前三家店,B表格不用管了 08/12 11:01
agogoman:那是接下來其他問題的延伸,故我把題目定為找前三,簡易化 08/12 11:06
chgc:select top 3 a.store_name ... from a, b where... order by 08/12 12:47
fumizuki:order by sales desc 08/13 20:08