Click here to Skip to main content
15,897,187 members
Home / Discussions / Database
   

Database

 
GeneralRe: generate specific format in sql table Pin
Mycroft Holmes11-Dec-11 22:11
professionalMycroft Holmes11-Dec-11 22:11 
AnswerRe: generate specific format in sql table Pin
PIEBALDconsult12-Dec-11 1:54
mvePIEBALDconsult12-Dec-11 1:54 
GeneralRe: generate specific format in sql table Pin
sk_ko12-Dec-11 2:57
sk_ko12-Dec-11 2:57 
AnswerRe: generate specific format in sql table Pin
jschell12-Dec-11 8:51
jschell12-Dec-11 8:51 
AnswerRe: generate specific format in sql table Pin
Eddy Vluggen12-Dec-11 10:15
professionalEddy Vluggen12-Dec-11 10:15 
Questionupdate and view news headline Pin
Jassim Rahma10-Dec-11 21:48
Jassim Rahma10-Dec-11 21:48 
AnswerRe: update and view news headline Pin
Wayne Gaylard10-Dec-11 22:26
professionalWayne Gaylard10-Dec-11 22:26 
QuestionGet start date Pin
Elizabeth Rani7-Dec-11 23:50
Elizabeth Rani7-Dec-11 23:50 
Hi all,

DECLARE
@holidayCount AS int,
@startDate AS datetime,
@endData AS datetime,
@empCode AS VARCHAR(20)

SET @startDate='12/6/2011 00:00:00.000'
SET @endDate='12/8/2011 23:59:59.997'
SET @empCode='EMP001'

SET @holidayCount=(SELECT COUNT(*) FROM tbl_holidays WHERE
holidays BETWEEN @startDate AND @endDate)

--I am assuming that 'holidays' is a datetime field/column

SELECT empCode, name, (Counts + @holidayCount) As holidayCounts
FROM
(
SELECT a.empCode, b.name, (Count(*) as Counts
FROM tbl_leaveentry a,tbl_emp b
WHERE a.empCode=b.empCode AND
a.empCode=@empCode AND
a.entryDate @startDate and @endDate
GROUP BY by a.empCode,b.name
) AS temp
WHERE Counts + @holidayCount>3

From the above query i got the count but now i need to get the start date of the leave that an employee had applied.

eg. 'EMP001' had applied leave from 12/1/2011 to 12/8/2011

but i have only one date option that is the end date. once you select the date option like 12/8/2011 it searches the dates from 2days before like 12/6/2011 and 12/8/2011 and returns the employees who have taken leaves continuously but i need to get the start date of the leave applied by the employee.

eg. EMP001 had applied leave from 12/1/2011 to 12/8/2011

Please suggest that how can i do this task any help will be appreciated
AnswerRe: Get start date Pin
Hum Dum8-Dec-11 0:11
Hum Dum8-Dec-11 0:11 
GeneralRe: Get start date Pin
Elizabeth Rani8-Dec-11 0:25
Elizabeth Rani8-Dec-11 0:25 
AnswerRe: Get start date Pin
SilimSayo8-Dec-11 10:49
SilimSayo8-Dec-11 10:49 
QuestionHow to Call A web service inside SQL server Pin
yousefshokati7-Dec-11 17:30
yousefshokati7-Dec-11 17:30 
AnswerRe: How to Call A web service inside SQL server Pin
David Skelly7-Dec-11 22:26
David Skelly7-Dec-11 22:26 
GeneralRe: How to Call A web service inside SQL server Pin
yousefshokati8-Dec-11 0:28
yousefshokati8-Dec-11 0:28 
AnswerRe: How to Call A web service inside SQL server Pin
SilimSayo8-Dec-11 8:27
SilimSayo8-Dec-11 8:27 
QuestionExporting and Importing data from and into SQL Server 2008 Pin
SQL Ed7-Dec-11 2:58
SQL Ed7-Dec-11 2:58 
AnswerRe: Exporting and Importing data from and into SQL Server 2008 Pin
Blue_Boy7-Dec-11 3:11
Blue_Boy7-Dec-11 3:11 
QuestionSum the counts from two different tables Pin
Elizabeth Rani7-Dec-11 1:04
Elizabeth Rani7-Dec-11 1:04 
AnswerRe: Sum the counts from two different tables Pin
Corporal Agarn7-Dec-11 8:46
professionalCorporal Agarn7-Dec-11 8:46 
AnswerRe: Sum the counts from two different tables Pin
SilimSayo7-Dec-11 12:50
SilimSayo7-Dec-11 12:50 
GeneralRe: Sum the counts from two different tables Pin
Elizabeth Rani7-Dec-11 19:46
Elizabeth Rani7-Dec-11 19:46 
GeneralRe: Sum the counts from two different tables Pin
SilimSayo8-Dec-11 3:25
SilimSayo8-Dec-11 3:25 
Questioncreate user account Pin
Danzy835-Dec-11 15:40
Danzy835-Dec-11 15:40 
AnswerRe: create user account Pin
Mycroft Holmes5-Dec-11 16:52
professionalMycroft Holmes5-Dec-11 16:52 
GeneralRe: create user account Pin
Danzy835-Dec-11 21:57
Danzy835-Dec-11 21:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.