我正在创建一个查询,不知怎的,我的查询似乎有问题.
这是我的查询:
Select
E.last_name as [Last Name],
E.first_name as [First Name],
SUM(CASE WHEN empAttendance.status = 'Absent' THEN 1 ELSE 0 END) as [Absences],
SUM(CASE WHEN empAttendance.status = 'Late' THEN 1 ELSE 0 END) as [Number of Lates]
from
empAttendance
INNER JOIN employee E ON empAttendance.emp_id = E.emp_id
WHERE E.company_id = (Select company_id from company Where company_name = @company)
Run Code Online (Sandbox Code Playgroud)
其中employee表的emp_id列是PK,empAttendance的emp_id为FK.
employee表有列last_name和first_name列.
错误说: Column 'employee.last_name' is invalid in the select list because it is not contained in either …
有人可以检查我的代码,我不知道它有什么问题.每当我执行代码时,我都会在标题中得到错误.
<?php
$file = "newfile.txt";
$text = "This is a text line. ";
$handle = fopen($file, "w");
fwrite($handle, $text);
fclose($handle);
$handle = fopen($file, "a");
$text = "Here are more text lines to insert."
fwrite($handle, $text);
fclose($handle);
include ($file);
?>
Run Code Online (Sandbox Code Playgroud)