Re: SQL Gurus Welcome here. by Tom
Tom
Wed Feb 01 10:55:05 CST 2006
cindy, this code is closer to what i want to return in the query, However, if
i could get the 2 dates ranges in different colums it would be perfect, right
now it combines the count in one, i have to have the WHERE and OR statment
on their own.
SELECT AGENCY,DEPT,COUNT(*);
FROM newmem ;
where (empdate between gomonth(checkhdr.procdate,-1) and checkhdr.procdate
AND INLIST(dept,24,34,35,38));
or (empdate between checkhdr.procdate and gomonth(checkhdr.procdate,1) AND
INLIST(dept,24,34,35,38));
Group by 1,2;
INTO cursor TOM
SELECT TOM
brow
"Cindy Winegarden" wrote:
> Hi Tom,
>
> Select ;
> SomeStuffHere1, SomeStuffHere2, ;
> Sum(Iif(Between(ProcDate, Date1, Date2), 1, 0)) As Column1, ;
> Sum(Iif(Between(ProcDate, Date3, Date4), 1, 0)) As Column2 ;
> From ....... ;
> Group By SomeStuffHere1, SomeStuffHere2
>
> Get as far as you can and post the SQL you come up with if it still doesn't
> work.
>
> --
> Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
> cindy_winegarden@msn.com www.cindywinegarden.com
>
>
> "Tom" <Tom@discussions.microsoft.com> wrote in message
> news:B4C9DCB4-AB75-4631-AF15-4005A211C1FB@microsoft.com...
> > Cindy, you have good reason to be confused because my Client is to, and
> > its
> > made me confused.
> >
> > we have Closing dates (procdate), what i am trying to list in 2 columns is
> > the number of records of people that the hiredate(empdate) falls between
> > the
> > last procdate and current procdate, then the second list, empdate falls
> > between the current procdate and the future procdate. i think. lol, now im
> > confused again.
> >
> > "Cindy Winegarden" wrote:
> >
> >> Hi Tom,
> >>
> >> You can use And and Or in a Where clause. However, what you've described
> >> is
> >> a little confusing since any dates that are less than two months ahead
> >> will
> >> also be less than one month ahead. Maybe you want something like:
> >>
> >> Where ;
> >> (empdate <= GOMONTH(checkhdr.procdate,1) AND INLIST(dept,<some list
> >> here>)) ;
> >> Or ;
> >> (empdate <= GOMONTH(checkhdr.procdate,2) AND INLIST(dept,<a different
> >> list here>))
> >>
> >>
> >>
> >>
> >> --
> >> Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
> >> cindy_winegarden@msn.com www.cindywinegarden.com
> >>
> >>
> >> "Tom" <Tom@discussions.microsoft.com> wrote in message
> >> news:6D8E4098-7749-4B9C-986B-70105274A99E@microsoft.com...
> >> > Can you have 2 "WHERE" statements in the same select?
> >> > WHERE empdate <= GOMONTH(checkhdr.procdate,1) AND
> >> > (INLIST(dept,24,34,35,38))
> >> > and
> >> > WHERE empdate <= GOMONTH(checkhdr.procdate,2) AND
> >> > (INLIST(dept,24,34,35,38))
> >>
> >>
> >>
>
>
>