case when a.id='1' from
时间: 2024-04-30 08:19:12 浏览: 104
It looks like your SQL statement is incomplete. The `CASE` statement is used to conditionally return a value based on one or more conditions. However, in your example, you only have the beginning of the statement (`CASE WHEN a.id='1' FROM`).
Assuming you want to return a specific value when `a.id` is equal to `'1'`, the correct syntax would be:
```
SELECT CASE WHEN a.id = '1' THEN 'Value when ID is 1' ELSE 'Value when ID is not 1' END as my_column
FROM my_table a
```
In this example, the `CASE` statement checks if `a.id` is equal to `'1'`. If it is, the value `'Value when ID is 1'` is returned. If it is not, the value `'Value when ID is not 1'` is returned. The result is returned as a column named `my_column` from the table `my_table` (which you will need to replace with your actual table name).
阅读全文