day range in the day range of the other table

  • ECDNoDischDt

    1000756532010-12-31

    1000670862010-12-16

    1000678382010-12-11

    1000734292010-12-28

    1000036742010-07-28

    1000598602010-11-21

    1000623102010-12-02

    1000640072010-12-04

    1000531002010-11-12

    1000633192010-12-01

    table

    ADTInfo

    ECDNoProcDt

    127402392010-07-15

    127402392010-07-15

    127402392010-07-15

    127402392010-07-14

    127402392010-07-17

    DiagnosisandProc

    I will like to check the ProDate in DiagnosisandProc is within the min day and max day of the dischDate in ADTInfo

    table.

  • What is your expected output and what have you tried so far?



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • I expect out come will be DiagnosisandProc has record come out if the date in the range. If not, I will have error message for the end user as no records in the range.

  • Frances L (1/17/2011)


    I will like to check the ProDate in DiagnosisandProc is within the min day and max day of the dischDate in ADTInfo table.

    Have you checked out the MIN and MAX functions?

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

  • Min and max function is working fine. I have problem to write in sql. thx.

Viewing 5 posts - 1 through 4 (of 4 total)

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