2011年12月21日 星期三

COUNT( ) 回傳筆數

SQL COUNT(column_name) Syntax

returns the number of values (NULL values will not be counted) of the specified column

SELECT COUNT(column_name) FROM table_name



The COUNT(*) function returns the number of records in a table:

SELECT COUNT(*) FROM table_name










O_IdOrderDatePrice顧客
120011/11/12100ans
220011/11/12100dce
320011/11/14100abc
420011/11/15100ans


尋找顧客ans購買次數:

SELECT COUNT(顧客) AS CustomerNilsen FROM Orders
WHERE 顧客='ans'

沒有留言: