SELECT MAX(imagefileid) AS imagefileid FROM docimagefile WHERE docid=? AND docfiletype=12 GROUP BY id ORDER BY imagefileid DESC 改为 docfiletype = 3,6,7,12其中一个时使出
时间: 2024-02-17 15:04:00 浏览: 48
对指定文件夹的图像名称进行排序
4星 · 用户满意度95%
你的SQL查询语句可以改为以下任意一种:
1. 当docfiletype等于3时,SQL查询语句为:
```
SELECT MAX(imagefileid) AS imagefileid
FROM docimagefile
WHERE docid=? AND docfiletype=3
GROUP BY id
ORDER BY imagefileid DESC
```
2. 当docfiletype等于6时,SQL查询语句为:
```
SELECT MAX(imagefileid) AS imagefileid
FROM docimagefile
WHERE docid=? AND docfiletype=6
GROUP BY id
ORDER BY imagefileid DESC
```
3. 当docfiletype等于7时,SQL查询语句为:
```
SELECT MAX(imagefileid) AS imagefileid
FROM docimagefile
WHERE docid=? AND docfiletype=7
GROUP BY id
ORDER BY imagefileid DESC
```
4. 当docfiletype等于12时,SQL查询语句为:
```
SELECT MAX(imagefileid) AS imagefileid
FROM docimagefile
WHERE docid=? AND docfiletype=12
GROUP BY id
ORDER BY imagefileid DESC
```
请注意,以上SQL查询语句只是将原来的docfiletype条件改为了3、6、7或12。如果其他条件不变,可以直接使用上述查询语句,否则请根据实际情况进行修改。
阅读全文