select distinct

Results 1 to 2 of 2

Thread: select distinct

  1. #1
    Join Date
    Dec 1969

    Default select distinct

    hi, this gives me duplicate prodname&#039;s, I want distinct prodname&#039;s<BR><BR>getSQL = "SELECT DISTINCT prodname, prodprice1, prodimagesm, prodid, prodsum, colours, vars From products WHERE prodcat = "&" &#039;" & choice1 & "&#039; AND prodsubcat = &#039;" & choice2 & "&#039; ORDER BY prodname, prodsum DESC"

  2. #2
    Join Date
    Dec 1969

    Default RE: select distinct

    SELECT DISTINCT only returns *RECORDS* that are completely distinct. You can&#039;t say "just give me one record per prodname". If you have two records that have the same prodname by differ in *ANY* of the other fields you are SELECTing, then they are distinct records. Period.<BR><BR>Think about it a sec:<BR><BR>Prodname -- colour<BR>Blanket -- red<BR>Blanket -- blue<BR>Blanket -- white<BR><BR>Now you say "SELECT DISTINCT Prodname, colour ..."<BR><BR>How is the poor database program supposed to *guess* (and that&#039;s all it could do is guess!) which of those three you wanted???<BR><BR>Time to come up with a better definition of the problem and find a different solution.<BR><BR>

Posting Permissions

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