List:General Discussion« Previous MessageNext Message »
From:H L Date:April 11 2006 8:05pm
Subject:Select a value between dates.
View as plain text  
I am far from an mysql expert... but is there a way to select between dates 
in a table and check if a value exists in all fields between dates. If one 
day between those dates cannot be booked i dont want to get it in my SUM 
resultset.

I want to calculate Sum between those dates and i one idea i have is to use 
the count to determine if i can use the result but it does not feels right. 
..

anyway the query looks like this

SELECT
`companyobjects`.`objectid`,
`companyobjects`.`objectname`,
Sum(`completereservationcredentials`.`price`),
Count(`completereservationcredentials`.`price`)
FROM
`completereservationcredentials`
Inner Join `companyobjects` ON `completereservationcredentials`.`objectid` = 
`companyobjects`.`objectid`
WHERE
`completereservationcredentials`.`avaliable` = 1 AND
`completereservationcredentials`.`reservationid` = 0 AND
`completereservationcredentials`.`thedate` >= '2006-08-01' AND
`completereservationcredentials`.`thedate` < '2006-08-10' AND
`companyobjects`.`companyid` = 'somecompanyid'
GROUP BY
`completereservationcredentials`.`objectid`
ORDER BY
`companyobjects`.`objectname` ASC

_________________________________________________________________
Lättare att hitta drömresan med MSN Resor http://www.msn.se/resor/

Thread
Select a value between dates.H L11 Apr
  • Re: Select a value between dates.Rhino11 Apr
RE: Select a value between dates.George Law12 Apr
  • Re: Select a value between dates.gerald_clark12 Apr