Results 1 to 2 of 2
  1. #1
    Join Date
    May 2003
    Posts
    23

    Arrow Unanswered: Need help with some date range issues.

    Now doing a report summary listing of a date range

    I made use of

    select.......where...between...and...

    But the user requested that if let's say he selected

    Jan to October

    But on Aug, if there's no reports, the summary would show up that in Aug, there's no reports.

    How to check whether a particular month has no report entries using sql?

    pls advise. Thanks.

    The front end is using ASP.

  2. #2
    Join Date
    Jul 2002
    Location
    Village, MD
    Posts
    621
    What about thia idea?

    create table #month(id int)
    create table #report(id int,rdate datetime)
    go
    insert #month values(1)
    insert #month values(2)
    insert #month values(3)
    insert #month values(4)
    insert #month values(5)
    insert #month values(6)
    insert #month values(7)
    insert #month values(8)
    insert #month values(9)
    insert #month values(10)
    insert #month values(11)
    insert #month values(12)

    insert #report values(1,'01.01.2003')
    insert #report values(1,'05.01.2003')
    insert #report values(1,'06.01.2003')
    insert #report values(1,'11.01.2003')
    go
    select id,(select count(*) from #report where datepart(month,rdate)=#month.id)
    from #month

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •