SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Zealot stuffedbuggy's Avatar
    Join Date
    Sep 2008
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy need unique entries... distinct not working

    I have a table with 3 columns. ex: column A, column B, column C.
    Column B has a unique index. The problem is, even though there are no duplicates in column B, There may be 5000 exact matches in Column A. I can't use a unique on column A cause column A isn't immediately populated, and may be left blank for sometime. And column B reflects all the different pages(unique). (If I apply unique to Column A I lose half of what I got in Column B) I tried SELECT DISTINCT, but it has no effect at all. The results are the same whether I use it or not. Please help, I've been suffering with this delima for a while now. Thanks.
    You know you cooler than me...

  2. #2
    SitePoint Addict
    Join Date
    Jun 2006
    Location
    Durban, South Africa
    Posts
    287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you post some sample data, and what exactly you are trying to select?

  3. #3
    SitePoint Zealot stuffedbuggy's Avatar
    Join Date
    Sep 2008
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Title | example/a |Summary a
    Title | example/b |Summay b
    Title | example/c |Summary c
    | example/d |
    |example/e |

    I can't apply a unique to the Title or Summary Fields cause the center(example/?) fills up 10 times faster than the Title or Summary, and the Unique Index will erase the entire record because of the null values
    You know you cooler than me...

  4. #4
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,495
    Mentioned
    161 Post(s)
    Tagged
    4 Thread(s)
    Why do you want to apply a unique index to the title or summary field?
    What are you trying to achieve?

  5. #5
    SitePoint Zealot stuffedbuggy's Avatar
    Join Date
    Sep 2008
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cause I can't have different pages(Column B) represented by the same name multiple times, more precisely, this is my webcrawler for my search engine. It gets title, links, and a description of each page. However different pages have the same title, which makes it harder on the viewer requesting search results. The webpage links are inserted into my database at a rate of 100/1. Then the title and descriptions are retrieved. I simply can't have say 1500 different pages from Amazon.com represented with the same title Amazon. I thought of query-ing each title before updating the records, but this causes too much processing power and waste even more time.
    You know you cooler than me...

  6. #6
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,220
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    the unique key should be url, all the other columns should be free to repeat
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  7. #7
    SitePoint Zealot stuffedbuggy's Avatar
    Join Date
    Sep 2008
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    THE URL is UNIQUE, my problem comes to the search, I don't want 5000 same titles matching 5000 different urls. It wouldn't be as bad if the description varied greatly on each page, but a lot of these url's have the same description too. So even though all the url's are unique, the user has no way of knowing exactly what they're searching for.. because everything looks the same. Example: GOOGLE will omit search results that tend to repeat in descriptive context and title. This is what I'm looking for. I tried "SELECT DISTINCT title,link,summary .... but there's nothing distinct about it.
    You know you cooler than me...


Bookmarks

Posting Permissions

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