我有两张表,一张表(singer)有三个field,id_singer,id_place,placename
其中id_singer,id_place中有数据,placename为空。
另一张表(place)有两个field,id_place,placename
id_place,placename中都有数据。我现在想通过查询singer表的id_place,查询和place表相同的id_place,将place.placename 写入到singer.placename。
我写了半天都没写出来,insert into singer(place)
select place.placename from place,singer
where singer.id_place = place.id_place;
我照上面写出来,结果报错,说id_singer没有默认值?
各位大侠帮帮忙啊!
谢谢!
其中id_singer,id_place中有数据,placename为空。
另一张表(place)有两个field,id_place,placename
id_place,placename中都有数据。我现在想通过查询singer表的id_place,查询和place表相同的id_place,将place.placename 写入到singer.placename。
我写了半天都没写出来,insert into singer(place)
select place.placename from place,singer
where singer.id_place = place.id_place;
我照上面写出来,结果报错,说id_singer没有默认值?
各位大侠帮帮忙啊!
谢谢!
set singer.placename=place.placename
where re singer.id_place = place.id_place;
where singer.id_place = place.id_place;
是否有结果
join place as b
on a.id_place=b.id_place
set a.placename=b.placename