How to do this query?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • starlight849
    New Member
    • Jun 2009
    • 82

    How to do this query?

    Say I have a table that looks like this...

    Code:
    COLA  COLB  COLC  COLD COLE COLF
    I have a query that looks like this....
    Code:
    SELECT COLA, COLB, COLC, COLD, COLE, COLF
          from mydatabase
          where COLD <= '5' and COLE >= '5';
    This query works fine and returns the data I want so far.
    Now, it is possible at time that COLA and COLB could have duplicate data, yet the remainder of the columns will be different. (ex below) In these cases I need I only want to see one row, but the entire row be returned... Is this possible?

    Code:
    COLA  COLB  COLC  COLD COLE COLF
    Jenny B     1      2    3    4
    Jenny B     2      3    4    5
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    If the other columns don't matter, don't return them and use a distinct clause.

    Otherwise, you will need a way to decide which of the two rows you want returned.

    Comment

    Working...