从子查询发送列

时间:2015-08-21 11:21:54

标签: mysql sql subquery

一个交易和其他客户有两个表。我获得了多行customerid和服务时间,但我想要客户名称(在客户表中)和服务时间。所以我尝试了下面的查询,这是无效的。

select name,service_time from CUSTOMER,TRANSACTION
WHERE id IN 
(
    select customer_id,service_time from TRANSACTION 
    where  service_date='$date' and employee_id='$employee_id'
);

1 个答案:

答案 0 :(得分:0)

使用SELECT c.name, t.service_time FROM CUSTOMER AS c JOIN TRANSACTION AS t ON t.customer_id = c.id WHERE t.service_date = '$date' AND employee_id = '$employee_id'

  yum install ./ABCpython34u-3.4.3-2.ius.el6.x86_64.rpm ./ABCpython34u-libs-3.4.3-2.ius.el6.x86_64.rpm

请参阅