Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Where clause trouble

Status
Not open for further replies.

kickballmvp2006

Technical User
Jan 4, 2007
30
US
Here is my query:

SELECT
b.wkend, round(sum([a.HC_GO]+[a.HP_GO]+[a.AX_GO]+[a.DI_GO]+[a.MV_GO]+[a.CH_GO]+[a.Or_GO])/sum([a.HC_GT]+[a.HP_GT]+[a.AX_GT]+[a.DI_GT]+[a.MV_GT]+[a.CH_GT]+[a.Or_GT])*100,2) AS MTD_PERC
FROM WkTotOff AS a, tblCalendar454 AS b
WHERE a.TDate between b.WkStart and b.Wkend
GROUP BY b.WkEnd;

This query gives me good data.
Now I want to say where MTD_PERC => .15
How would I do that?

Help is much appreciated.
 
I should have mentioned that I want to be able to do that
in addition to what I already have. So I am sorting
and showing all weeks (by weekending date) where MTD_PERC => .15
 
oh, really????

well, in that case, try it like this --
Code:
[red]select * from ([/red]
[blue]SELECT b.wkend
     , round(sum([a.HC_GO]
                +[a.HP_GO]
                +[a.AX_GO]
                +[a.DI_GO]
                +[a.MV_GO]
                +[a.CH_GO]
                +[a.Or_GO])
            /sum([a.HC_GT]
                +[a.HP_GT]
                +[a.AX_GT]
                +[a.DI_GT]
                +[a.MV_GT]
                +[a.CH_GT]
                +[a.Or_GT])*100,2) AS MTD_PERC
  FROM WkTotOff AS a
INNER
  JOIN tblCalendar454 AS b
    ON a.TDate between b.WkStart and b.Wkend
GROUP 
    BY b.WkEnd[/blue]
[red]) as foo
where MTD_PERC => .15[/red]

r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top