我是sqlite
查询的新手。任何人都可以告诉我如何通过选择设置一些特定的行?
MY_TABLE
+------------+--------------+----------+
| client_id | product_type | value |
+============+==============+==========+
| 2 | 2 | Server |
| 2 | 4 | Domain |
| 2 | 2 | Hosting |
| 3 | 2 | Dialer |
| 2 | 3 | Drive |
+------------+--------------+----------+
我如何才能获得client_id
和product_type
,只有下面的行集 -
+-------------+---------------+
| client_id | product_type |
+=============+===============+
| 2 | 3 |
| 3 | 2 |
+-------------+---------------+
答案 0 :(得分:0)
sqlite> SELECT client_id,product_type
...> FROM client
...> GROUP BY client_id;
答案 1 :(得分:-2)
SELECT sensor_id,event_type FROM events group by sensor_id ORDER BY sensor_id ASC;