I have 2 tables 1 is EMployeeMaster and another is Attendance
***EmployeeMaster***
EmployeeId EmployeeName DepartmentId
1 ABC 1
2 XYZ 2
3 PQR 2
4 WXY 1
Now i have another table Attendance
***Attendance***
AttendanceId EmployeeId Date InTime OutTime
1 1 2011-04-04 00:00:00 10:00 AM 6:30 PM
2 2 2011-04-04 00:00:00 09:45 AM 7:10 PM
Once employee comes in office and put his finger on device his entry will be go to Attendance table with InTime ,EMployeeId and Date.
So the employee who is not come into office ,his entry will not exist in the Attendance table.
Now i want to generate daily report..It should show attendance of all the employee of company along with their Intime/outTime by date.
All the employees who are absent they also should be displayed in this report.
So i want :
EmployeeId EMployeeName DepartmentId Date InTime OutTime
1 ABC 1 2011-04-04 00:00:00 10:00 AM 6:30 PM
2 XYZ 2 2011-04-04 00:00:00 09:45 AM 7:10 PM
3 PQR 2 NULL/- NULL/- NULL/-
4 WXY 1 NULL/- NULL/- NULL/-
Can you tell me what should be query???
You should use a left outer join.
declare #E table (EmployeeId int, EmployeeName varchar(50), DepartmentId int)
declare #A table (AttendanceId int, EmployeeId int, [Date] date, InTime time, OutTime time)
insert into #E values
(1, 'ABC', 1),
(2, 'XYZ', 2),
(3, 'PQR', 2),
(4, 'WXY', 1)
insert into #A values
(1, 1, '2011-04-04 00:00:00', '10:00 AM', '6:30 PM'),
(2, 2, '2011-04-04 00:00:00', '09:45 AM', '7:10 PM')
select
E.EmployeeId,
E.EmployeeName,
E.DepartmentId,
A.[Date],
A.InTime,
A.OutTime
from #E as E
left outer join #A as A
on E.EmployeeId = A.EmployeeId and
A.[Date] = '2011-04-04 00:00:00'
Result
EmployeeId EmployeeName DepartmentId Date InTime OutTime
----------- -------------------------------------------------- ------------ ---------- ---------------- ----------------
1 ABC 1 2011-04-04 10:00:00.0000000 18:30:00.0000000
2 XYZ 2 2011-04-04 09:45:00.0000000 19:10:00.0000000
3 PQR 2 NULL NULL NULL
4 WXY 1 NULL NULL NULL
Edit 1
If you need to do this for one month I would use some kind of number table or calendar table. Here I have used a cte to build the calendar using #FromDate and #ToDate
declare #E table (EmployeeId int, EmployeeName varchar(15), DepartmentId int)
declare #A table (AttendanceId int, EmployeeId int, [Date] date, InTime time, OutTime time)
insert into #E values
(1, 'ABC', 1),
(2, 'XYZ', 2),
(3, 'PQR', 2),
(4, 'WXY', 1)
insert into #A values
(1, 1, '2011-04-02', '04:00 AM', '4:30 PM'),
(2, 2, '2011-04-02', '05:00 AM', '5:30 PM'),
(3, 1, '2011-04-03', '06:00 AM', '6:30 PM'),
(4, 2, '2011-04-03', '07:00 AM', '7:30 PM'),
(5, 1, '2011-04-04', '08:00 AM', '8:30 PM'),
(6, 2, '2011-04-05', '09:00 AM', '9:10 PM')
-- Set FromDate to first day of month
declare #FromDate date = '20110401'
-- Set ToDate to last day of month
declare #ToDate date = '20110405'
-- Create cte with all dates between FromDate and ToDate
;with cteCal as
(
select #FromDate as [Date]
union all
select dateadd(d, 1, [Date]) as [Date]
from cteCal
where [Date] < #ToDate
)
select
E.EmployeeId,
E.EmployeeName,
E.DepartmentId,
C.[Date],
A.InTime,
A.OutTime
from cteCal as C
cross join #E as E
left outer join #A as A
on E.EmployeeId = A.EmployeeId and
C.[Date] = A.[Date]
order by C.[Date], E.EmployeeName
option (maxrecursion 0)
Should look like this:
select
EmployeeId,
EmployeeName,
DepartmentId,
Date,
InTime,
OutTime
from EmployeeMaster em
left join Attendance a on em.EmployeeId=a.EmployeeId and Date='2011-04-04 00:00:00'
select E.EmloyeeId, EmployeeName, DepartmentId, Date, InTime, OutTime
from EmployeeMaster as e
LEFT JOIN Attendance as a ON a.EmloyeeId = e.EmloyeeId
Related
I need to copy all rows of a table, changing only the date part of the Datetime. The query I've been testing in sqlfiddle, returns record count of 0, and obviously the #newDate + SameTime isn't part of the query, but I put it there so you know what I want to do.
CREATE TABLE Games
(
[Id] int IDENTITY(1, 1) PRIMARY KEY,
[GameTypeId] int,
[DateCreated] datetime,
[DateTime] datetime,
[Location] int
);
INSERT INTO Games ([GameTypeId], [DateCreated], [DateTime], [Location])
VALUES ('1', GETDATE(), '8/21/2021 8:00:00', '1'),
('2', GETDATE(), '8/21/2021 9:00:00', '1'),
('2', GETDATE(), '8/21/2021 10:00:00', '1');
The query I'm testing to copy the rows but is not working:
INSERT INTO Games (GameTypeId, DateCreated, DateTime, Location)
SELECT
GameTypeId, GETDATE(), #newDate + SameTime, Location
FROM
Games
WHERE
CONVERT(date, DateTime) = '8/21/2021'
The results from the initial insert:
Id GameTypeID DateCreated DateTime Location
--------------------------------------------------------------
1 1 8/15/2021 8/21/2021 8:00:00 1
2 1 8/15/2021 8/21/2021 9:00:00 1
3 1 8/15/2021 8/21/2021 10:00:00 1
And after the copy rows query, the results I want (but can't get). I want to copy everything to a new row, except the date only needs to change. The time stays the same:
4 1 8/20/2021 8/28/2021 8:00:00 1
5 1 8/20/2021 8/28/2021 9:00:00 1
6 1 8/20/2021 8/28/2021 10:00:00 1
You can use date arithmetic:
INSERT INTO Games (GameTypeId, DateCreated, DateTime, Location)
SELECT GameTypeId, DATEADD(day, 5, DateCreated),
DATEADD(day, 7, DateTime), location
FROM Games
WHERE CONVERT(date, DateTime) = '2021-08-21'
I am stuck on a particular scenario when a employee changes his/her department.
Here are the exact details:
I have 2 tables-Department and Employee in SAP HANA database.
Dept_ID|Start_Date |End_Date
1 |15-Jan-2017|31-Dec-9999
Emp_ID|Dept_ID|Start_Date |End_Date
123 |1 |1-Jan-2017 |31-Dec-9999
456 |1 |1-Jan-2017 |31-Dec-9999
789 |1 |1-Jan-2017 |25-Jan-2017
789 |2 |26-Jan-2017 |31-Dec-9999
666 |1 |23-Jan-2017 |31-Dec-9999
What i need in the output is count of employees in each department over time -
Dept_ID|Emp_Count|Start_Date |End_Date
1 |3 |15-Jan-2017|23-Jan-2017
1 |4 |23-Jan-2017|25-Jan-2017
1 |3 |25-Jan-2017|31-Dec-9999
I tried with CTE using sum over (partition), but i am not able to get the desired result.
Please help me in solving this problem.
Edit:
Adding create definitions and insert statements
CREATE COLUMN TABLE DEPT ("DEPT_ID" NVARCHAR(400) NOT NULL ,
"START_DATE" LONGDATE CS_LONGDATE NOT NULL ,
"END_DATE" LONGDATE CS_LONGDATE NOT NULL ,
PRIMARY KEY INVERTED VALUE ("DEPT_ID",
"START_DATE")) UNLOAD PRIORITY 5 AUTO MERGE
CREATE COLUMN TABLE EMP ("EMP_ID" NVARCHAR(400) NOT NULL ,
"DEPT_ID" NVARCHAR(4000),
"START_DATE" LONGDATE CS_LONGDATE NOT NULL ,
"END_DATE" LONGDATE CS_LONGDATE NOT NULL ,
PRIMARY KEY INVERTED VALUE ("EMP_ID",
"START_DATE")) UNLOAD PRIORITY 5 AUTO MERGE
insert into DEPT values('1','15.01.2017 22:58:09.0','31.12.9999 00:00:00.0')
insert into EMP values('123','1','01.01.2017 22:58:09.0','31.12.9999 00:00:00.0')
insert into EMP values('456','1','01.01.2017 22:58:09.0','31.12.9999 00:00:00.0')
insert into EMP values('789','1','01.01.2017 22:58:09.0','25.01.2017 10:00:00.0')
insert into EMP values('789','2','25.01.2017 10:00:00.0','31.12.9999 00:00:00.0')
insert into EMP values('666','1','23.01.2017 22:58:09.0','31.12.9999 00:00:00.0')
Unfortunately I'm unable to test it on SAP HANA, therefore, I post a solution for SQL Server. I tried to use syntax that I found valid for SAP HANA as well.
with dates as
(
select *, row_number() over (partition by t.dept_id order by dat) rn
from
(
select dept_id, start_date dat from emp where emp.start_date > (select start_date from dept where dept_id = emp.dept_id)
union all
select dept_id, end_date dat from emp where emp.end_date < (select end_date from dept where dept_id = emp.dept_id)
union all
select dept_id, start_date dat from dept
union all
select dept_id, end_date dat from dept
) t
)
select e.dept_id, count(*), t.startd, t.endd
from emp e
join
(
select d1.dept_id, d1.dat startd, d2.dat endd
from dates d1
join dates d2 on d1.dept_id = d2.dept_id and d1.rn + 1 = d2.rn
) t on t.dept_id = e.dept_id and e.start_date < t.endd and e.end_date > t.startd
group by e.dept_id, t.startd, t.endd
demo
RESULT
dept_id count startd endd
1 3 15/01/2017 23/01/2017
1 4 23/01/2017 25/01/2017
1 3 25/01/2017 31/12/9999
I wasn't able to complete this yesterday but as I had some preparation already done here are some small alterations to the solution by Radim Bača. The differences are:
use a join to include the department from/to dates on employee rows
use the lead() function instead of row_number() (which avoids a self-join)
there is a department 2 row in the departments table
Demo at SQL Fiddle
CREATE TABLE Department
([Dept_ID] int, [Start_Date] datetime, [End_Date] datetime)
;
INSERT INTO Department
([Dept_ID], [Start_Date], [End_Date])
VALUES
(1, '2017-01-15 00:00:00', '9999-12-31 00:00:00'),
(2, '2017-01-15 00:00:00', '9999-12-31 00:00:00')
;
CREATE TABLE Employee
([Emp_ID] int, [Dept_ID] int, [Start_Date] datetime, [End_Date] datetime)
;
INSERT INTO Employee
([Emp_ID], [Dept_ID], [Start_Date], [End_Date])
VALUES
(123, 1, '2017-01-01 00:00:00', '9999-12-31 00:00:00'),
(456, 1, '2017-01-01 00:00:00', '9999-12-31 00:00:00'),
(789, 1, '2017-01-01 00:00:00', '2017-01-25 00:00:00'),
(789, 2, '2017-01-26 00:00:00', '9999-12-31 00:00:00'),
(666, 1, '2017-01-23 00:00:00', '9999-12-31 00:00:00')
;
Query 1:
WITH
e AS (
SELECT e.*, d.start_date stdt, d.end_date endt
FROM Employee e
INNER JOIN Department d ON e.dept_id = d.dept_id
),
range AS (
SELECT
dept_id
, start_date AS from_date
, LEAD(start_date) OVER (PARTITION BY dept_id
ORDER BY start_date) to_date
FROM (
SELECT dept_id , start_date FROM e WHERE e.start_date > e.stdt
UNION ALL
SELECT dept_id , end_date FROM e WHERE e.end_date < e.endt
UNION ALL
SELECT dept_id , start_date FROM Department
UNION ALL
SELECT dept_id , end_date FROM Department
) r
)
SELECT
e.dept_id
, r.from_date
, r.to_date
, COUNT(*) num_employees
FROM Employee e
INNER JOIN range r ON e.dept_id = r.dept_id
AND e.start_date < r.to_date
AND e.end_date > r.from_date
AND r.to_date IS NOT NULL
GROUP BY
e.dept_id
, r.from_date
, r.to_date
Results:
| dept_id | from_date | to_date | num_employees |
|---------|----------------------|----------------------|---------------|
| 1 | 2017-01-15T00:00:00Z | 2017-01-23T00:00:00Z | 3 |
| 1 | 2017-01-23T00:00:00Z | 2017-01-25T00:00:00Z | 4 |
| 1 | 2017-01-25T00:00:00Z | 9999-12-31T00:00:00Z | 3 |
| 2 | 2017-01-26T00:00:00Z | 9999-12-31T00:00:00Z | 1 |
Please see below written in SQL server.
DECLARE #Department TABLE
(
[Dept_ID] [int] NOT NULL,
[Start_Date] [date] NOT NULL,
[End_Date] [date] NOT NULL
)
DECLARE #Employee TABLE
(
[Emp_ID] [int] NOT NULL,
[Dept_ID] [int] NOT NULL,
[Start_Date] [date] NOT NULL,
[End_Date] [date] NOT NULL
)
DECLARE #Ranges TABLE
(
[Range_ID] [int] NOT NULL,
[Dept_ID] [int] NOT NULL,
[Start_Date] [date] NOT NULL,
[End_Date] [date] NOT NULL
)
INSERT INTO #Department (Dept_ID, Start_Date, End_Date)
VALUES (1, '15-Jan-2017', '31-Dec-9999')
INSERT INTO #Employee (Emp_ID, Dept_ID, Start_Date, End_Date)
VALUES (123,1,'1-Jan-2017','31-Dec-9999'),
(456,1,'1-Jan-2017','31-Dec-9999'),
(789,1,'1-Jan-2017','25-Jan-2017'),
(789,2,'26-Jan-2017','31-Dec-9999'),
(666,1,'23-Jan-2017','31-Dec-9999')
INSERT INTO #Ranges (Range_ID,Dept_ID, Start_Date, End_Date)
VALUES (1,1,'20170115','20170123'),
(2,1,'20170123','20170125'),
(3,1,'20170125','99991231')
SELECT E.Dept_ID, COUNT(*) As Emp_Count, R.Start_Date, R.End_Date
FROM #Employee E
INNER JOIN #Department D ON D.Dept_ID = E.Dept_ID
INNER JOIN #Ranges R ON R.Dept_ID = D.Dept_ID
WHERE 1=1
AND E.Start_Date <= R.Start_Date
AND E.End_Date >= R.End_Date
AND D.Start_Date <= R.Start_Date
AND D.End_Date >= R.End_Date
GROUP BY E.Dept_ID, R.Start_Date, R.End_Date
sql fiddle example
I have this table structure :
CREATE TABLE TIMETABLE
([ID] int, [Name] varchar(50), [StartDate] datetime, [EndDate] datetime)
;
INSERT INTO TIMETABLE
([ID], [Name], [StartDate], [EndDate])
VALUES
(1, 'John', '2017-01-29 16:00:00.000', '2017-01-29 16:12:00.000'),
(2, 'Mario', '2017-01-29 16:17:00.000', '2017-01-29 16:29:00.000'),
(3, 'Kate', '2017-01-15 10:35:00.000', '2017-01-15 10:40:00.000'),
(4, 'Maria', '2017-01-15 10:17:00.000', '2017-01-15 10:27:00.000'),
(5, 'Oliver', '2017-01-15 13:46:00.000', '2017-01-29 14:00:00.000')
;
And The result for this :
select * from TIMETABLE
ID Name StartDate EndDate
1 John 2017-01-29T16:00:00Z 2017-01-29T16:12:00Z
2 Mario 2017-01-29T16:17:00Z 2017-01-29T16:29:00Z
3 Kate 2017-01-15T10:35:00Z 2017-01-15T10:40:00Z
4 Maria 2017-01-15T10:17:00Z 2017-01-15T10:27:00Z
5 Oliver 2017-01-15T13:46:00Z 2017-01-29T14:00:00Z
I want to know with a range from 15 mins in wich range is the date, for example:
ID Name StartDate EndDate HourRangeTime
1 John 2017-01-29T16:00:00Z 2017-01-29T16:12:00Z 16:00
In the example the startdate and the enddate is in the range between 16:00 and 16:12 is in the range 16:00
The result it should be like this:
ID Name StartDate EndDate HourRangeTime
1 John 2017-01-29T16:00:00Z 2017-01-29T16:12:00Z 16:00
2 Mario 2017-01-29T16:17:00Z 2017-01-29T16:29:00Z 16:15
3 Kate 2017-01-15T10:35:00Z 2017-01-15T10:40:00Z 10:30
4 Maria 2017-01-15T10:17:00Z 2017-01-15T10:27:00Z 10:15
5 Oliver 2017-01-15T13:46:00Z 2017-01-29T14:00:00Z 13:45
How can I fill the column HourRangeTime, take dates and see what range does it belong to?
Your seem focused on the StartDate.
A relatively general way to do this is to convert this to minutes and then truncate the minutes to the nearest 15 minutes. Here is code:
select cast(dateadd(minute,
15 * (datediff(minute, 0,
cast(StartDate as time)
) / 15
), 0
) as time)
This returns the result as a time.
You can get difference and process future.
SELECT StartTime, EndTime, DATEDIFF(MINUTE, StartTime , EndTime) AS MinuteDiff
FROM TIMETABLE
You can try this for your desired output:
SELECT
CONCAT(DATEPART(hh,StartDate), ':',
CASE
WHEN DATEPART(MINUTE,StartDate) BETWEEN 0 AND 14 THEN '00'
WHEN DATEPART(MINUTE,StartDate) BETWEEN 15 AND 29 THEN '15'
WHEN DATEPART(MINUTE,StartDate) BETWEEN 30 AND 44 THEN '30'
WHEN DATEPART(MINUTE,StartDate) BETWEEN 45 AND 59 THEN '45'
ELSE '00'
END) AS HourRangeTime
FROM TIMETABLE
OUTPUT:
HourRangeTime
-------------
16:00
16:15
10:30
10:15
13:45
You can use this.
SELECT *,
CONVERT(VARCHAR,DATEPART(HOUR, [StartDate]))
+ ':'
+ RIGHT(CONVERT(VARCHAR,(DATEPART(MINUTE, [StartDate]) / 15) * 15)+'0',2) HourRangeTime FROM TIMETABLE
I have two attendance tables.One isemployeelist and another is attendence_info.Employeelist contain Emp_Id and Emp_name. Attendance_info is Emp_Id, Date.As below:
Emp_ID Date
----------- -----------------------
1 2014-12-11 00:00:00.000
2 2014-12-11 00:00:00.000
4 2014-12-11 00:00:00.000
5 2014-12-11 00:00:00.000
2 2014-12-10 00:00:00.000
4 2014-12-10 00:00:00.000
5 2014-12-10 00:00:00.000
1 2014-12-09 00:00:00.000
2 2014-12-09 00:00:00.000
3 2014-12-09 00:00:00.000
Here each date some id are absent. I want to find out all absent list with date.Please help to find it by Sql server query. My desired output should be as below:
absentId Date
3 2014-12-11 00:00:00.000
1 2014-12-10 00:00:00.000
3 2014-12-10 00:00:00.000
4 2014-12-09 00:00:00.000
5 2014-12-09 00:00:00.000
You can do this by generating a list of all employees and dates and then removing the ones where the employee is present. This is basically a cross join and left join:
select el.emp_id, d.date
from (select distinct date from Attendance_info) d cross join
employeelist el left join
Attendance_info ai
on ai.date = d.date and ai.emp_id = el.emp_id
where ai.emp_id is null;
select e.Emp_ID as absentId,a.Date as date
from employeelist e
join attendence_info a
on e.Emp_ID=a.Emp_ID
order by a.Date
DECLARE #StartDate DATETIME = '2014-12-09'
DECLARE #EndDate DATETIME = '2014-12-11'
;WITH MyCte ([Date])
AS
(
SELECT [Date] = #StartDate
UNION ALL
SELECT DATEADD(DAY, 1, [Date]) FROM MyCte WHERE [Date] < #EndDate
)
,EmployeeList ([EmpID], [Date])
AS
(
SELECT 1, '2014-12-11 00:00:00.000' UNION
SELECT 2, '2014-12-11 00:00:00.000' UNION
SELECT 4, '2014-12-11 00:00:00.000' UNION
SELECT 5, '2014-12-11 00:00:00.000' UNION
SELECT 2, '2014-12-10 00:00:00.000' UNION
SELECT 4, '2014-12-10 00:00:00.000' UNION
SELECT 5, '2014-12-10 00:00:00.000' UNION
SELECT 1, '2014-12-09 00:00:00.000' UNION
SELECT 2, '2014-12-09 00:00:00.000' UNION
SELECT 3, '2014-12-09 00:00:00.000'
)
SELECT DISTINCT E.[EmpID], M.[Date]
FROM EmployeeList E
CROSS APPLY (SELECT [Date] FROM MyCTE WHERE [Date] NOT IN (SELECT [Date] FROM EmployeeList WHERE EmpID = E.EmpID)) M
Let's say I have a table called EmployeeInfo like following:
Name Hours StartTime Date
John Smith 8 8:00 2013-12-11
John Smith 7 7:00 2013-12-10
John Smith 9 6:00 2013-12-09
Tom Smith 6 9:00 2013-12-11
Tom Smith 8 7:00 2013-12-10
Tom Smith 7 5:00 2013-12-05
Alex Smith 8 8:00 2013-12-10
I want query to return the following table:
Name HoursToday HoursWeekly StartTime Date
John Smith 8 24 8:00 2013-12-11
Tom Smith 6 14 9:00 2013-12-11
Where all info is taken from today's date except HoursWeekly, which is the sum of Hours from the given date (lets say 2013-12-9) till today. And the info should pop up only if employee has a record as of today (2013-12-11).
Any help would be appreciated.
DECLARE #t TABLE
(
Name VARCHAR(50),
Hours INT,
StartTime TIME,
Date1 DATE
)
INSERT INTO #t
SELECT 'John Smith', 8, '8:00', '2013-12-11' UNION ALL
SELECT 'John Smith', 7, '7:00', '2013-12-10' UNION ALL
SELECT 'John SMITH', 9, '6:00', '2013-12-09' UNION ALL
SELECT 'Tom Smith', 6, '9:00', '2013-12-11' UNION ALL
SELECT 'Tom SMITH', 8, '7:00', '2013-12-10' UNION ALL
SELECT 'Tom SMITH', 7, '5:00', '2013-12-05' UNION ALL
SELECT 'Alex SMITH', 8, '8:00', '2013-12-10'
DECLARE #input DATE= '2013-12-9';
WITH cte1 AS
(
SELECT name,
hours HoursToday,
StartTime,
Date1
FROM #t
WHERE DATEDIFF(DAY, date1, GETDATE()) = 0
),
CTE AS
(
SELECT name,
SUM(hours) HoursWeekly
FROM #t
WHERE date1 BETWEEN #input AND GETDATE()
AND name IN (SELECT name FROM cte1)
GROUP BY name
)
SELECT a.Name,
a.HoursToday,
b.HoursWeekly,
a.StartTime,
a.Date1
FROM cte1 A
INNER JOIN cte B ON a.Name = b.Name
A cleaner solution than the accepted answer
SELECT e1.Name, e1.Hours HoursToday, e2.HoursWeekly, e1.StartTime, e2.Date
FROM EmployeeInfo e1
JOIN (
SELECT Name, MAX(Date) Date, SUM(Hours) HoursWeekly
FROM EmployeeInfo
WHERE Date >= CONVERT(DATE, GETDATE() - 7)
GROUP BY Name
HAVING MAX(Date) >= CONVERT(DATE, GETDATE())
) e2 ON e1.name = e2.Name AND e1.Date = e2.Date
select * from
(select name, hours, StartTime, Date,
SUM(hours) over (partition by name) as totalHours
from mytable) m1
where Date = GETDATE()
Try this, haven't tested as don't have similar table but logic should work
select Name,
Sum(case when date = CONVERT(VARCHAR(10),GETDATE(),111) then Hours else 0 end) as HoursToday,
Sum(case when date between dateadd(dd,-7,getdate()) and getdate() then Hours else 0 end) as HoursWeekly,
Min(case when date = CONVERT(VARCHAR(10),GETDATE(),111) then StartTime else '' end) as StartTime,
Date as Date
where date = '2013-12-11'
group by name,date
I believe this would work.
SELECT Name, Hours,
(SELECT SUM(Hours) FROM EmployeeInfo WHERE Name = ei.Name
AND [Date] BETWEEN '12/4/2011' AND '12/11/2011') As HoursWeekly,
StartTime, [Date]
FROM EmployeeInfo ei WHERE ei.[Date] = '12/11/2011'