-1

それが私のテーブルです:

mat_id| yes| no | type
  1   | 1  | 0  |  3
  1   | 1  | 0  |  3
  2   | 1  | 1  |  3
  3   | 1  | 0  |  3

私の選択クエリ:

$q = $db->select()->from('tableName', 'mat_id')->where('type = ?', 3)->group('yes')->having('COUNT(yes) > 1');

しかし、なぜ選択するmat_id = 1必要があるのmat_id =1,3ですか?

4

1 に答える 1

0

これを試して、

$db->select()->->distinct()->from('tableName', 'mat_id')->where('type = ?', 3)->group('yes')->having('COUNT(yes) > 1');
于 2012-09-24T11:28:11.160 に答える