Click here to Skip to main content
15,888,461 members
Home / Discussions / Database
   

Database

 
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 
Try something like:

SQL
select name, sum(counts)
from(
    select a.empcode as empcode,b.name,count(*) as counts 
    from tbl_leaveentry a
    INNER JOIN tbl_emp b
        ON a.empcode=b.empcode
    where  a.empcode='EMP001'
        and a.entrydate between '11/24/2011'; and '11/27/2011'
    group by a.empcode, b.name

    union
    
    select null, null, count(*) as counts 
    from tbl_holidays
    where holidays between '11/24/2011' and '11/27/2011'

) as c 
GROUP BY name
having sum(counts)>=3 

Note the GROUP BY and I have changed to an INNER JOIN.

Hope this helps. Sorry, I do not have time to dive deeper into this.
[edit]to spell note correctly[/edit]

modified 14-Dec-11 15:19pm.

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 
QuestionIntegration Services or C# code Pin
RichardInToronto5-Dec-11 15:00
RichardInToronto5-Dec-11 15:00 
AnswerRe: Integration Services or C# code Pin
Mycroft Holmes5-Dec-11 16:49
professionalMycroft Holmes5-Dec-11 16:49 
GeneralRe: Integration Services or C# code Pin
Jörgen Andersson5-Dec-11 20:30
professionalJörgen Andersson5-Dec-11 20:30 
GeneralRe: Integration Services or C# code Pin
RichardInToronto7-Dec-11 15:35
RichardInToronto7-Dec-11 15:35 
AnswerRe: C# code Pin
David Mujica6-Dec-11 5:55
David Mujica6-Dec-11 5:55 
GeneralRe: C# code Pin
RichardInToronto7-Dec-11 4:09
RichardInToronto7-Dec-11 4:09 
GeneralRe: C# code Pin
David Mujica7-Dec-11 8:08
David Mujica7-Dec-11 8:08 
GeneralRe: C# code Pin
RichardInToronto7-Dec-11 15:31
RichardInToronto7-Dec-11 15:31 
GeneralRe: C# code Pin
Mycroft Holmes7-Dec-11 15:55
professionalMycroft Holmes7-Dec-11 15:55 
Questiondatabase role permissions Pin
Danzy835-Dec-11 3:53
Danzy835-Dec-11 3:53 
AnswerRe: database role permissions Pin
R. Giskard Reventlov5-Dec-11 4:11
R. Giskard Reventlov5-Dec-11 4:11 

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.