select max(convert(int,a18)) as a18 from [table] where tabletype in ('c7b85913-21e2-4f14-8a4d-b0374439de28','c7b85913-21e2-4f14-8a4d-b0374439de28','1ae1aa6a-79db-43d8-8550-64992099a5af','bcea9114-af09-47ac-af7d-b84c68719a5b')=======这一语句有错误吗?查不出最大数
解决方案 »
- 请教个group by 时间的问题
- CREATE TABLE 语句后的 ON [PRIMARY] 起什么作用呀?好象没有也行呀?请教
- sql server 如何做健康性检查?
- 文件组 'PRIMARY' 已满的问题,请高手帮帮忙,小女子多谢了!急!!!!!!!!!!!
- 怪事,我机子上的 Sql Query Analyzer 查询某个数据库的时候,非常慢。其他人的机子没这个问题。
- 高手回答:在什么情况下使用内联结,在什么情况下使用外联结呢?在什么情况下不使用联结呢?
- 请问sql server数据库中的datetime的格式是什么?
- 关于Pivot的问题。为什么会自动合并行????????急求答案在线。Thanks!
- 数据库备份和恢复的问题
- 如何删除重复的记录
- 问个对我很难的问题
- |zyciis| 如何完全防止网站数据库注入呢 大家来看看我的方法 这样做 还有什么办法可以注入 第三贴 大家给我总结一下
from [table]
where tabletype in (
'c7b85913-21e2-4f14-8a4d-b0374439de28'
,'c7b85913-21e2-4f14-8a4d-b0374439de28'
,'1ae1aa6a-79db-43d8-8550-64992099a5af'
,'bcea9114-af09-47ac-af7d-b84c68719a5b') 这样有结果吗?
DROP TABLE TEST
CREATE TABLE TEST(ID INT)
INSERT TEST
SELECT 1 UNION ALL
SELECT 2 UNION ALL
SELECT 3 UNION ALL
SELECT 4 UNION ALL
SELECT 5
GOSELECT * FROM TESTSELECT MAX(ID) FROM TEST WHERE ID IN(1,3,5)
-----------
5(所影响的行数为 1 行)
/*a b c
----------- ---- -----------
1 x 10
1 y 100
1 h 30
6 c 80
6 z 50(5 行受影响)*/
select max(a) from tb where c in (10,30,50)
/*
-----------
6(1 行受影响)
*/
from [table]
where tabletype in
('c7b85913-21e2-4f14-8a4d-b0374439de28',
'c7b85913-21e2-4f14-8a4d-b0374439de28',
'1ae1aa6a-79db-43d8-8550-64992099a5af',
'bcea9114-af09-47ac-af7d-b84c68719a5b')
这样就OK拉
from [table]
where tabletype in (
'c7b85913-21e2-4f14-8a4d-b0374439de28'
,'c7b85913-21e2-4f14-8a4d-b0374439de28'
,'1ae1aa6a-79db-43d8-8550-64992099a5af'
,'bcea9114-af09-47ac-af7d-b84c68719a5b')
这样有结果。
但
select max(convert(int,a18)) as a18 from [table] where tabletype in ('c7b85913-21e2-4f14-8a4d-b0374439de28','c7b85913-21e2-4f14-8a4d-b0374439de28','1ae1aa6a-79db-43d8-8550-64992099a5af','bcea9114-af09-47ac-af7d-b84c68719a5b')
这样就不行,查询不出最大值,a18为varchar类型