Results 1 to 5 of 5

Thread: [RESOLVED] sql server 2000 - query to find same values in columns of same row

  1. #1

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    My Mustang GT
    Posts
    4,566

    Resolved [RESOLVED] sql server 2000 - query to find same values in columns of same row

    I am working with a database table called "zip". My guess is we bought it from a vendor. It contains cities, states, zip and longitude/latitude of the cities plus a lot of other data. There is a column called CITYSTNAME and another column called LL_CITY. I would like to run a query that finds out if these two values are always the same, so that if not, I can decide which is the better to use when I am looking up a city. My hope is they are not always the same - otherwise why have them? (My other hope is that I have been using the correct one all along).

    Thanks.
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: sql server 2000 - query to find same values in columns of same row

    Is this what you are after?
    Code:
    SELECT CITYSTNAME, LL_CITY
    FROM zip
    WHERE CITYSTNAME <> LL_CITY
    If they are always the same, it wont return any data.

  3. #3

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    My Mustang GT
    Posts
    4,566

    Re: sql server 2000 - query to find same values in columns of same row

    It didn't return any data.

    Isn't that stupid? Why have two columns always containing the same value? There are 70,500 rows in the table.
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: sql server 2000 - query to find same values in columns of same row

    That is rather odd, presumably there was a reason for it... but it is likely to be one of those that you never find out.

  5. #5

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    My Mustang GT
    Posts
    4,566

    Re: sql server 2000 - query to find same values in columns of same row

    Quote Originally Posted by si_the_geek View Post
    ... it is likely to be one of those that you never find out.
    I'll just add it to the heap!

    Thanks, as always, for your help, Si.
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

Posting Permissions

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



Click Here to Expand Forum to Full Width