drop table if exists line_state;
CREATE TABLE `line_state` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`fromCityId` int(11),
`toCityId` int(11),
`value` int(11),
PRIMARY KEY (`id`),
foreign key(fromCityId) references city(id),
foreign key(toCityId) references city(id)
);
CREATE TABLE `city` (
`id` int(11) NOT NULL,
`name` VARCHAR(20) NOT NULL,
PRIMARY KEY (`id`)
)DEFAULT CHARSET=utf8;
select ls.id, c.name ,ls.value, ls.toCityId from line_state ls inner join city c on ls.fromCityId=c.id order by ls.id asc;
我现在的这个ls.fromCityId 可以与外键连接变成 中文字,但是ls.toCityId怎么变成中文字?
select ls.id, c.name ,ls.value, ls.toCityId ,d.name from line_state ls inner join city c on
order by ls.id asc;