getting all the days of week eevn if data doesnt exist

  • Hi,

    I've tried this before but just not getting it... sorry..

    I have an aux.date table with date info date, dayofweek, kindofday etc

    I want to have a start and end date(using SSRS) to find recorded services

    so lets say the put in 7/1/13 thru 7/5/13 and 7/4 is a holiday and no recorded services exist

    I want output similar to:

    date record serv KINDOFDAY

    7/1/13 recservdata1 .. Weekday

    7/1/13 recservdata2... WeekDay

    7/2/13 recservdata3... Weekday

    7/3/13 recservdata4... Weekday

    7/4/13 NULL Holiday

    7/5/13 recservdata5... Weekday

    etc...

    I have a view which grabs the days of the week (rpt_cal_Select)

    then I attached to this but on get records with data...

    SELECT dbo.RECORDED_SERVICE.SERVICE_ITEM_MONIKER, dbo.rpt_Cal_Select.Date AS Expr1, dbo.SERVICE_ITEM.Code, dbo.rpt_Cal_Select.*,

    dbo.RECORDED_SERVICE.OID

    FROM dbo.rpt_Cal_Select INNER JOIN

    dbo.RECORDED_SERVICE ON dbo.rpt_Cal_Select.Date = DATEADD(dd, 0, DATEDIFF(dd, 0, dbo.RECORDED_SERVICE.STARTTIME)) LEFT OUTER JOIN

    dbo.SERVICE_ITEM ON dbo.RECORDED_SERVICE.SERVICE_ITEM_MONIKER = dbo.SERVICE_ITEM.OID

    Thanks

    Joe

  • In order to display records for dates which are not found in the table you are reporting on, you should build you query based on your calendar table aux.date which then you should LEFT JOIN to the rest of tables.

    You have providede too little information in order to write exact query you can use. If you need more help, please read the article from the link found at the bottom of my signature. It explains what is required in order to attract most relevant and prompt help.

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply