NameSilo

SQL Date Range

Spaceship Spaceship
Watch

jdickson

Established Member
Impact
1
I need a query that will select all records from 2/1/2008 through 2/28/08 along with selecting fields for todays date only (date() )

It is counting total points a user is accumulating throughout the month and displaying the total next to their name. Also "Todays Today" needs to be displayed next to their name. Is this possible?


Name Month to date total Today's total
xxxxx 99999 99999




Thanks in advance!!
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
What DBMS are you using?
 
0
•••
if you show us the sql you are currently using it should be possible without too much hassle.

Also as monaco asks what is the database engine you are using.
 
0
•••
a tabular report of totals for month and day for all users?

i think something like:

select tablea.userid, tablea.username, thismonth.monthtotal, thisday.daytotal
from table tablea

inner join (
select sum(fieldA) as monthtotal, userid
from table tableb
where datefield > 2/1/2008
and datefield < 2/28/08
group by userid ) thismonth on thismonth.userid = tablea.userid

inner join (
select sum(fieldA) as daytotal, userid
from table tablec
where datefield = CURDATE()
group by userid ) thisday on thisday.userid = tablea.userid
 
0
•••
Dynadot — .com TransferDynadot — .com Transfer
Appraise.net

We're social

Domain Recover
DomainEasy — Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back