SELECT a.id, a.name, a.code1 AS code1, a.code2, a.code3, a.provider, a.create_time, a.parent_id, b.NAME AS parentName, b.provider AS parentProvider, b.code1 AS parentCode1, b.type AS parentType, FROM device a left Join device b on a.parent_id=b.id WHERE a.is_deleted=0 AND a.type=51 这句sql有什么问题
时间: 2024-03-12 09:46:03 浏览: 67
SM2246AA主控量产工具N0307A.rar
这句 SQL 语句中有一个问题:最后一个 SELECT 子句中多了一个逗号。应该把最后一个 SELECT 子句改为:
```
SELECT a.id, a.name, a.code1 AS code1, a.code2, a.code3, a.provider, a.create_time, a.parent_id, b.NAME AS parentName, b.provider AS parentProvider, b.code1 AS parentCode1, b.type AS parentType FROM device a left Join device b on a.parent_id=b.id WHERE a.is_deleted=0 AND a.type=51
```
另外,建议在 SQL 语句中的表名、字段名、关键字等使用大写,以便于阅读和识别。
阅读全文