Hi Peter, > I am working on a search logging script to count the most popular word or > phrases searched for. > > Table > > I could add a line for each search, and aggregate the results for reports, > but I was wondering about the following which would keep table sizes down. > > | search word | count | > ========================= > | Nuts | 125 | > | Bolts | 119 | > | Screws | 110 | > | Washers | 98 | > > If the word is already in the table increment the counter, if not add the > word and set counter to 1 > > query 1 => update counter where word = "search word" > > if no records updated > query 2 => insert word and set counter to 1 > > Is there a single query that will do this or does it have to be 2?
Two - sorry! =dn --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php