偶想把几个查询结果合成一个表,sql如下
select count(*) from studenttable where 户籍地 like '%大山居%' and
union select count(*) from studenttable where 户籍地 like '%小山居%' and
union select count(*) from studenttable where 户籍地 like '%大小山居%'和分析器测试,出错:
数据类型 bigint 对于函数 substring 无效。允许的类型为: char/varchar、nchar/nvarchar 和 binary/varbinary。请问要怎样写才对?
select count(*) from studenttable where 户籍地 like '%大山居%' and
union select count(*) from studenttable where 户籍地 like '%小山居%' and
union select count(*) from studenttable where 户籍地 like '%大小山居%'和分析器测试,出错:
数据类型 bigint 对于函数 substring 无效。允许的类型为: char/varchar、nchar/nvarchar 和 binary/varbinary。请问要怎样写才对?
解决方案 »
- 同一个表中做累计差求本期如何处理
- 急问一个SQL问题(单表),在线等!
- Order by 能否排序某field里的内容,如select * from table order by fiedl1 like ‘%头%’, field1 like ‘尾’ ??请赐教!!(请看例子)
- 请问怎样在win2k个人版下装SQL?(在线等)
- 怎么删除指定其中一个字符后的所有字符
- 我用JDBC驱动连接JSP程序,采用的是SQL Server,运行一个程序后,提示数据库登录不上,请问该如何解决???
- 哪里有sql server7.0下载?
- 为何dbgrid的竖滚动条下拉不是按照一条记录一条记录往下走呀
- sqlserver+asp如何实现图像的存储和显示?
- 怎么写这样一个SQL语句,通过一个表的字段查询出另一个字段的值,这个值与另一个表的值相乘求和后并分类统计
- 为什么我用了多个or条件以后再用and就,and条件就不起作用了?
- 求教更新语句
union
select count(*) from studenttable where 户籍地 like '%小山居%'
union
select count(*) from studenttable where 户籍地 like '%大小山居%'
union all不会
select count(*) from studenttable where 户籍地 like '%大山居%' and substring(班级编号,6,2)='11'
结果提示:
数据类型 bigint 对于函数 substring 无效。允许的类型为: char/varchar、nchar/nvarchar 和 binary/varbinary。
“班级编号”在数据库里是bigint型,请问要怎样写才对?
tanxiangfeng(黑鼻子) 你真聪明