原sql为:
SELECT
bus_car.car_id,
bus_car.car_name,
bus_customer.customer_id,
bus_customer.cust_name,
bus_rent.rent_id,
bus_rent.begin_date,
bus_rent.end_date,
bus_rent.price,
bus_rent.rent_flag,
bus_rent.oper_name,
bus_rent.rent_time,
bus_rent.rent_remark,
bus_customer.phone,
bus_customer.identity,
bus_customer.sex,
bus_customer.driver_license,
bus_car.car_color
FROM
bus_car ,
bus_customer
INNER JOIN bus_rent ON bus_rent.car_id = bus_car.car_id AND bus_rent.customer_id = bus_customer.customer_id
给from后的两个表加上括号即可
SELECT
bus_car.car_id,
bus_car.car_name,
bus_customer.customer_id,
bus_customer.cust_name,
bus_rent.rent_id,
bus_rent.begin_date,
bus_rent.end_date,
bus_rent.price,
bus_rent.rent_flag,
bus_rent.oper_name,
bus_rent.rent_time,
bus_rent.rent_remark,
bus_customer.phone,
bus_customer.identity,
bus_customer.sex,
bus_customer.driver_license,
bus_car.car_color
FROM
(bus_car ,
bus_customer)
INNER JOIN bus_rent ON bus_rent.car_id = bus_car.car_id AND bus_rent.customer_id = bus_customer.customer_id
对,是我
发布了55 篇原创文章 · 获赞 14 · 访问量 6195
私信
关注