Cub Scout Crafts

Crafts, projects, games, and activities ideas for cub scouts.

RSS
people

Knot Card Giveaway Winners!!

Thank you to everyone who commented on our first post and for sharing us with your friends. We had a fantastic first weekend and are only looking to improve upon it. The response has been phenomenal!!

That being said, I know now the reason you’re all here. To find out who won the giveaway. I know many blogs use a random number generator to pull the winners. However, since I am Database Administrator for a living (when I’m not scouting), I can pull 3 random winners out of the database very easily with a single query, and here it is:

SELECT DISTINCT comment_author, comment_author_email FROM wp_comments WHERE comment_author_email NOT IN (‘cubmaster@cubscoutcrafts.com’,”) AND comment_post_ID=299 AND comment_date < ’2012-03-05 00:00:00′ ORDER BY RAND() LIMIT 3;

For those who don’t read SQL code, it breaks down like this:

SELECT DISTINCT comment_author, comment_author_email FROM wp_comments: Get all distinct comment authors and their respective email addresses from the database table that stores comments for all posts. The DISTINCT clause insures that anyone who posted  multiple comments are only selected once.

WHERE comment_author_email NOT IN (‘cubmaster@cubscoutcrafts.com’,”): This insures that we do not retrieve any comments posted by myself or where there is no email address, in the case of a trackback (link) to the post.

AND comment_post_ID=299: Select only the comments for post ID #299, which is the ID of this giveaway post

AND comment_date < ’2012-03-05 00:00:00′:┬áSelect only comments posted before the giveaway cutoff date.

ORDER BY RAND() LIMIT 3: Randomize the order of all the results that were found and then return only 3 results.

I just wanted to share that so everyone is familiar with it since that is the general code that I will be using to select all our giveaway winners (yes there WILL be more:)) and to let everyone know there is no bias or cheating (Scouts are honest, right?).

So, without further ado, here are the winners as selected directly out of the database:

mysql> SELECT DISTINCT comment_author, comment_author_email FROM wp_comments WHERE comment_author_email NOT IN (‘cubmaster@cubscoutcrafts.com’,”) AND comment_post_ID=299 AND comment_date < ’2012-03-05 00:00:00′ ORDER BY RAND() LIMIT 3;

+----------------+-----------------------------+
| comment_author | comment_author_email        |
+----------------+-----------------------------+
| SilverAnvil    | silveranvil@****************|
| Jennifer       | jennifermarkestad@**********|
| Heather        | heatherstamps@**************|
+----------------+-----------------------------+

Congratulations to our winners. I will contact you via the email address provided with your comment for further information. Stay tuned for more crafts and giveaways and thank you all for entering and sharing us with others.

In addition if you have a product, service, etc that you would like to donate for a giveaway, we will gladly accept it (scout related of course). Please contact me at cubmaster[at]cubscoutcrafts[dot]com to arrange it.

 
This post is tagged under: ,

Never miss another craft by subscribing to our RSS feed!

2Responsesto “Knot Card Giveaway Winners!!”

Comments

  1. Jennifer Says:

    WooHoo! Thank You!!

  2. Cubmaster Says:

    @Jennifer – You’re very welcome!

    Congratulations again to our three winners. Stay tuned for another giveaway in the near future. I already have another one on tap!! Watch for announcements!

Leave a Reply