开发人员技术 | Transact-SQL
ANSI SQL 语言的 Microsoft 扩展,包括过程编程、局部变量和各种支持函数。
这是我的查询语句:
SELECT
a.*, b.*,c.*, COUNT(a.EmailNum) as NumEmails
FROM
Emails.emails a
inner join
Employees.user b on a.ID=b.id
inner join
Employees.dept c on b.dept=c.deptid
where
a.is_read='0'and c.deptName='HR';
group by
b.id
Emails. emails(Table):
emailNum, id, emailcontent,receivers
1 , 11, "sasa" ,******@gmail.com
Employees user(Table)
userId, firstName, lastName, dept
1` , 'John' , 'Brown', 55
Employees dept(Table)
deptId, deptName
55 , 'HR'