AlHal2
asked on
Conversion of numbers to dates
This query is meant to retrieve a count of the no. of stocks that have prices in the last 8 days.
select E.exchangename,PH.marketda te,
count(*) as PriceToday
from exchange as E left outer join pricehistory as PH
on E.dsexchangecode=PH.dsexch angecode
where PH.marketdate > (select CONVERT(nvarchar(30), GETDATE(), 112)-8)
group by E.exchangename,PH.marketda te
The problem is that the dates are stored in format yyyymmdd, so it's doing arithmetic calcualations not date calculations. How do I convert it to dates?
select E.exchangename,PH.marketda
count(*) as PriceToday
from exchange as E left outer join pricehistory as PH
on E.dsexchangecode=PH.dsexch
where PH.marketdate > (select CONVERT(nvarchar(30), GETDATE(), 112)-8)
group by E.exchangename,PH.marketda
The problem is that the dates are stored in format yyyymmdd, so it's doing arithmetic calcualations not date calculations. How do I convert it to dates?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
and for the speed of the response.
ASKER