Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Posts
    38

    Unanswered: Query to return multiple date rows

    HI there,

    Can someone please help with a query I have? Basically I want to return all rows in a table that have multiple date entries that are different. For example:

    1636 1073746475 342 2005-12-30 00:00:00.000
    1636 1073746475 359 2006-03-10 00:00:00.000

    This security 1636 has two entries in the DB with different dates. They are lots of securities with multiple entries with the same date but I need a list of the ones with different dates. Any ideas please?

    Thanks!!!!!

    S

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Code:
    select	security,
    	count(distinct datevalue) as datecount
    from	[yourtable]
    group by security
    having count(*) > 1
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    You handle all the tough questions...time to shovel snow
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  4. #4
    Join Date
    Jan 2004
    Posts
    38
    Thanks that's a great help, much appreciated!!!

    S

Posting Permissions

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