2
我有一個表格「產品」,它包含如下所示的值。從表格組中獲取所有值一個字段
column-a column-b column-c column-d ....
1023 57 value1 value2 ....
1024 58 value3 value4 ....
1025 58 value5 value6 ....
1026 57 value7 value8 ....
1027 59 value9 value10 ....
1028 60 value11 value12 ....
1029 59 value13 value14 ....
從這張表我想要按列-b顯示如下組的結果。
陣列
(
[0] => stdClass Object
(
[column-a] => 1023
[column-b] => 57
[column-c] => value1
[column-d] => value2
.
.
.
)
[1] => stdClass Object
(
[column-a] => 1024
[column-b] => 58
[column-c] => value3
[column-d] => value4
.
.
.
)
[2] => stdClass Object
(
[column-a] => 1027
[column-b] => 59
[column-c] => value9
[column-d] => value10
.
.
.
)
[3] => stdClass Object
(
[column-a] => 1028
[column-b] => 60
[column-c] => value11
[column-d] => value12
.
.
.
)
[4] => stdClass Object
(
[column-a] => 1026
[column-b] => 57
[column-c] => value7
[column-d] => value8
.
.
.
)
[5] => stdClass Object
(
[column-a] => 1025
[column-b] => 58
[column-c] => value5
[column-d] => value6
.
.
.
)
[6] => stdClass Object
(
[column-a] => 1029
[column-b] => 59
[column-c] => value13
[column-d] => value14
.
.
.
)
)
如何通過柱-b選擇表羣組的所有表中的值。
我試圖像下面,但其顯示數值列B的唯一一次
SELECT * FROM products GROUP BY column-b;
有人幫助檢索與相同的所有數據。提前致謝!