的次數我有一個這樣的表在我的分貝:查詢來獲取一個項目出現
id --- owner --- product ---- type
0 --- john --- mustang ---- car
1 --- tim --- a360 ---- plane
2 --- john --- camry ---- car
3 --- dan --- a380 ---- plane
4 --- tim --- ninja ---- bike
5 --- dan --- accord ---- car
我試圖讓每種類型的所有者的數量。類似這樣的:
John
Car = 2
Plane = 0
Bike = 0
-------------
Tim
Car = 0
Plane = 1
Bike = 1
-------------
Dan
Car = 1
Plane = 1
Bike = 0
-------------
我一直無法解決這個問題。
另一個問題是我的數據庫能夠接受新的類型。例如,某人可以添加一輛自行車作爲一種類型。
有沒有辦法做到這一點?
我有點困惑,OP。被接受的答案不能給出你所期望的結果集。你究竟在尋找什麼? – AdamMc331 2014-10-26 21:44:40