Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 获取每个产品上每个员工的费率_Sql - Fatal编程技术网

Sql 获取每个产品上每个员工的费率

Sql 获取每个产品上每个员工的费率,sql,Sql,我有三张桌子 a有 b有 c是空的,并且有列 empId(fk) | prodID(fk) | rate 如何得到以下结果 empID | prodName | rate ------+----------+------ 1 | apple | 0.00 1 | banana | 0.00 1 | cherry | 0.00 2 | apple | 0.00 2 | banana | 0.00 2 | cherry

我有三张桌子

a有

b有

c是空的,并且有列

empId(fk) | prodID(fk) | rate
如何得到以下结果

empID | prodName | rate 
------+----------+------
   1  | apple    | 0.00
   1  | banana   | 0.00
   1  | cherry   | 0.00
   2  | apple    | 0.00
   2  | banana   | 0.00
   2  | cherry   | 0.00
   3  | apple    | 0.00
   3  | banana   | 0.00
   3  | cherry   | 0.00
empId(fk) | prodID(fk) | rate
empID | prodName | rate 
------+----------+------
   1  | apple    | 0.00
   1  | banana   | 0.00
   1  | cherry   | 0.00
   2  | apple    | 0.00
   2  | banana   | 0.00
   2  | cherry   | 0.00
   3  | apple    | 0.00
   3  | banana   | 0.00
   3  | cherry   | 0.00
  select a.empid,b.prodname,0.00 as rate
  from a as a cross join b as b