saihang 2007-4-22 11:12
想問一0的SQL Statement點寫,唔該幫0下手
呢個database要入呢三個table
[img]http://hk.geocities.com/jfksaihang/idb3.jpg[/img]
想做以下查詢
list晒唔同area之中邊個bal最大同最細個數目
list晒有邊個employee無order跟
customer names 同employee names要list成咁,for example landi wong變成Landi WONG,即係cfname或者efname要同clname或者elname combine埋一齊
比埋其他code你地睇
[url=http://hk.geocities.com/jfksaihang/lab4.txt]http://hk.geocities.com/jfksaihang/lab4.txt[/url]
testme 2007-5-6 09:50
questions are not clear.
data table definitions are not clear. (eg. id = no?)
joecat 2007-5-22 13:12
:DTRY TRY!!
list晒唔同area之中邊個bal最大同最細個數目
[b]SELECT area FROM customerfour WHERE MAX(bal), MIN(bal) GROUPBY area;[/b]
list晒有邊個employee無order跟
[b]SELECT * FROM employeefour, orderfour WHERE empid is null;[/b]
[[i] 本帖最後由 joecat 於 2007-5-22 13:25 編輯 [/i]]
joecat 2007-5-24 16:36
:oh:之前post的不太正確, 請試試下以下SQL!!!
[u]list晒唔同area之中邊個bal最大同最細個數目[/u]
[code]SELECT area, Max(bal) AS bal之最大值, Min(bal) AS bal之最小值
FROM customerfour
GROUP BY area;[/code]
[u]list晒有邊個employee無order跟, efname轉第一個字母大寫和elname全部字母大寫[/u]
[code]SELECT StrConv([efname],3) & " " & StrConv([elname],1) AS [Employee Name]
FROM employeefour LEFT JOIN orderfour ON empno = empid
WHERE (((empid) Is Null))
GROUP BY StrConv([efname],3) & " " & StrConv([elname],1);[/code]
以上SQL試過可在ACCESS運行的!!
[[i] 本帖最後由 joecat 於 2007-5-24 16:42 編輯 [/i]]