Results 1 to 4 of 4

Thread: Getting records for same value

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Getting records for same value

    I have two records, "Sawah Sempadan" and "sawah sempadan"

    How to get only "Sawah Sempadan" from Query ?It show me two records contains "sawah sempadan" and "Sawah Sempadan"

    Code:
     .Open "SELECT DISTINCT Kompartment FROM Kompartmen"

  2. #2
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    Re: Getting records for same value

    Hi,

    One thing about distinct, it does return the first record spotted in your table and does not matter about case sensitivity...i guess the small caps sawah sempadan was the first occurence in your table..If you re-arrange the record so that the capital Sawah Sempadan will be the first occurence, it will display with the desired result your after..

    Greg
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  3. #3
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    Re: Getting records for same value

    But let me guess, are they the same compartment?

    Greg
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  4. #4
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Getting records for same value

    What is the backend database?

    Case Sensitivity is a setting that can be changed on MS SQL Server. Although I believe it's a "server-wide" setting.

    But as was already questioned - are they the same compartment? If they are then that would have us question the table design you have selected, as proper normalization would never allow this to occur.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

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