queryWrapper.select("DISTINCT shift_group_name ").lambda().isNotNull(DwsVisualInspectionStatisticHour::getEquipmentName);为什么报错
时间: 2023-03-28 09:02:42 浏览: 121
这个报错可能是因为 DwsVisualInspectionStatisticHour 类中的 getEquipmentName 方法返回了 null 值,而 select 方法中使用了 isNotNull 方法,导致报错。建议检查一下 DwsVisualInspectionStatisticHour 类中 getEquipmentName 方法的实现,确保不会返回 null 值。
相关问题
为什么select distinct u.i_ui_identifier,u.nvc_user_name from t_user_info u join t_contact_person c on c.i_user_id = u.i_ui_identifier group by u.nvc_user_name;这个SQL语句报错:[SQL Server]选择列表中的列 't_user_info.i_ui_identifier' 无效,因为该列没有包含在聚合函数或 GROUP BY 子句中。 (8120),怎么解决
根据错误提示,SQL语句中的i_ui_identifier列没有包含在聚合函数或GROUP BY子句中。解决方法是将i_ui_identifier列添加到GROUP BY子句中,或者使用聚合函数对i_ui_identifier列进行聚合。例如,您可以将SQL语句修改为:
```
SELECT DISTINCT u.i_ui_identifier, u.nvc_user_name
FROM t_user_info u
JOIN t_contact_person c ON c.i_user_id = u.i_ui_identifier
GROUP BY u.i_ui_identifier, u.nvc_user_name;
```
这样就可以避免报错了。
select distinct tablespace_name from all_tables group by tablespace_name
在 SQL 中,你的查询语句是有问题的。你不能在使用 `GROUP BY` 之前使用 `DISTINCT` 关键字。如果你想获取所有表的唯一的 `tablespace_name`,你可以使用以下查询语句:
```sql
SELECT DISTINCT tablespace_name
FROM all_tables;
```
这个查询语句将返回 `all_tables` 表中唯一的 `tablespace_name` 值。每个不同的 `tablespace_name` 将作为结果返回,重复的值将被过滤掉。