select email,concat('<a href=',house.id,'.html>',house.title,'</a>')
as id from mail , house
where mail.keyword=house.title
and mj<=mjstop
结果如下:
[email protected] <a href=1.html>上海</a>
[email protected] <a href=2.html>北京</a>
[email protected] <a href=3.html>北京</a>
[email protected] <a href=4.html>上海</a>
select email, group_concat(convert (id,char(200)) ) as ebody
from
(select email,concat('<a href=',house.id,'.html>',house.title,'</a>')
as id from mail , house
where mail.keyword=house.title
and mj<=mjstop ) t
group by email
结果如下:
[email protected] <a href=1.html>,<a href=4.html>
[email protected] <a href=2.html>,<a href=3.html>
汉字怎么显示不出来了????
as id from mail , house
where mail.keyword=house.title
and mj<=mjstop
结果如下:
[email protected] <a href=1.html>上海</a>
[email protected] <a href=2.html>北京</a>
[email protected] <a href=3.html>北京</a>
[email protected] <a href=4.html>上海</a>
select email, group_concat(convert (id,char(200)) ) as ebody
from
(select email,concat('<a href=',house.id,'.html>',house.title,'</a>')
as id from mail , house
where mail.keyword=house.title
and mj<=mjstop ) t
group by email
结果如下:
[email protected] <a href=1.html>,<a href=4.html>
[email protected] <a href=2.html>,<a href=3.html>
汉字怎么显示不出来了????
show variables like 'char%'; 贴结果
或者
concat(' <a href=',cast(house.id as char),'.html>',house.title,' </a>')
character_set_connection utf8
character_set_database gb2312
character_set_filesystem binary
character_set_results utf8
character_set_server gb2312
character_set_system utf8
character_sets_dir C:\Program Files\MySQL\MySQL Server 5.1\share\charsets\
十分感谢!concat(' <a href=',cast(house.id as char),'.html>',house.title,' </a>') 出结果了
但是
concat(' <a href=',house.id,'.html>',convert(house.title using gbk),' </a>') 没有结果????
另外想请教一下
对于一个表操作a(t1,t2,t3,t4,t5)如果t5>0则选t1,t2;否则 选t3,t4
select case
when t5>0 then t1,t2
else t3,t4
end 好像是不对的只能用union吗?十分感谢!!!
对于一个表操作a(t1,t2,t3,t4,t5)如果t5>0则选t1,t2;否则 选t3,t4
select case
when t5>0 then t1,t2
else t3,t4
end
举例说明要求,如果取两个字段的值,可以用两个 CASE WHEN
改成utf8可以了,可否告诉一下原因??我感觉关于字符的问题不好明白,空和null什么区别??
张三 100 50 1
李四 50 0
王五 250 100 1
张三 510 0
王五 200 0
我load的数据本想为null确实空,load数据怎么为null,怎么判断数据为空???
十分感谢!!
字符集统一,NULL<>空
空:可以为一个空格怎么判断数据为空??如果是NULL
SELECT * FROM TT WHERE F1 IS NULL
空字符串
SELECT * FROM TT WHERE F1=‘’
请一句SQL写出:如果person(personname,deptname) 表中没有 “财务部”的“张三” ,那么请增加该人员。
Insert into person (personname,deptname)vales('张三',''财务部') 。用mysql能实现一句话么??
select distinct '张三','财务部' from tt where
not (deptname='财务部' and personname='张三')实际上直接用REPLACE INTO就OK
怎么使用distinct可以影响结果,例如
表t
A 2
B 1
C 3
insert into s2
select distinct 'd',8 from s2
where not (t6='d' and t5=8)
不适用disticnt增加三行(这个我感觉还能理解),使用disticnt怎么变成了一行??并且对于(d,8)能重复加入,
并不能避免存在不能加入问题????