1,理解左连接查询方式(以两表id相等作为on的条件): 先将左表数据查出,然后根据on后面的条件,将右表中凡是id与左表id相等的记录都查出来,与匹配的左表记录依次排成一行或多行,若无匹配的记录,则显示null。 举例:select * from test1 a left join test2 b on a.id=b.id 右连接语句:select * from test1 a right join test2 b on a.id=b.id select * from test1 a join test2 b on a.id=b.id select * from test1 a inner join test2 b on a.id=b.id select * from test1 a , test2 b where a.id=b.id select * from `test1 ` a where id in (select id from `test2` b);SELECT * FROM `test1 ` a,`test2` b where a.house_title=b.title; SELECT * FROM `houseprice_data` where id in (select id from `houseprice`); SELECT * FROM `houseprice` where house_id in (select id from `house`); 替换指定字符串update [表名] set 字段名 = replace(与前面一样的字段名,'原本内容','想要替换成什么')多张表UPDATE用法 update 1188fc_shouse a, 1188fc_house b set a.thumb = b.thumb where a.title = b.title where a.house_area=3361; 时间格式化 在指定字段前添加字符串SELECT `title`,`house_sale_phone`,CONCAT("http://m.1188fc.com", `wapurl`) AS `wapurl`,FROM_UNIXTIME(`inputtime`,'%Y-%m-%d') FROM `1188fc_house`;