Query Generates Winning Lottery Numbers!
Itzik Ben-Gan helps out a reader by creating a T-SQL query that generates winning lottery numbers.
March 27, 2008
As one of SQL Server Magazine’s most popular authors, Itzik Ben-Gan gets plenty of requests from readers to help them solve their T-SQL coding problems. But recently he got a request that was a little different.
“Dear Itzik: I’ve been a DBA for 10 years, and I love my job. But all my friends make a lot more money than me; they’re investment bankers or lawyers, or they sell stuff on eBay. I’ve had it with working harder than they do and having less to show for it. Since you’re a T-SQL expert, I thought you of all people could write a query to generate winning lottery numbers. If I had such a query, I’d never have to work again and would be the envy of my friends. Can you help me?”
As usual, Itzik came through and created the T-SQL query in Listing A (some code lines are wrapped in the print version). If it’s lottery numbers you want, this query delivers. See if you can figure out how it works!
Read more about this topic by visiting "Get Foolish."
About the Author
You May Also Like