Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以只选择多列的不同组合?
例如,只有客户和他们下订单的日期的不同组合(作为他们下订单的天数的表示)?
您要查找的是数据组(仅显示不同的值组合),您可以使用 GROUP BY 子句返回这些数据组。
SELECT customer_id, date FROM orders GROUP BY customer_id, date;
SELECT DISTINCT customerId, orderDate FROM table;
或者
SELECT DISTINCTROW customerId,orderDate FROM 表;