Forum Moderators: open
I have a table named Pages and two(2) columns.
This are the two columns named URL and PAGE
---------------------------------------------------------------
URL ¦ PAGE
[website1.com...] ¦ [website1.com...]
[website1.com...] ¦ [website1.com...]
[website1.com...] ¦ [website1.com...]
[website2.com...] ¦ [website2.com...]
[website2.com...] ¦ [website2.com...]
---------------------------------------------------------------
When i search the database i want to show one result per website.
I used DISTINCT and GROUP BY but is not working for me. I dont know what to do.
Maybe somebody can help me with this!
Im using ASP and SQL 2005 with Full-Text Search
Thanks!
This statement
SELECT DISTINCT URL, Page, Title from Pages where FREETEXT(Title, '"& request.querystring("q") &"')
This is asking for a distinct url + title + page so if they aren't all unique then it will create a new row for each unique combination of url + title + page
URL ¦ PAGE
[website1.com...] ¦ [website1.com...]
[website1.com...] ¦ [website1.com...]
The combination of URL and Page aren't unique so it has to show them both.
the results are show fast and when i use
SELECT * FROM (SELECT URL, Page, Title FROM Pages WHERE FREETEXT(Title, '"& request.querystring("q") &"') ) AS p1 WHERE Page = (SELECT MAX(Page) FROM Pages WHERE URL = p1.URL)
the query takes up to 10 minutes