T-Sql NOT IN is not returning expected results in SQL Server

I ran into this problem several times and when ever I encountered this problem I used to change my query to avoid this. But today I had sometime to dig into the root of this issue. Here are the problem, cause and the solution;

Lets take a simple example where you have a Customer table and a Invoice table (this is my favourite scenario since a POS system was my first ever commercial project). Invoice table has a foreign key to Customer table. Let say you have come across a situation where you want to find out customers who doesn't have any Invoices against them. You would probably write the following T-SQL (There are few other ways you can write this, but I know most of the SQL coders prefer IN and NOT IN);

SELECT customerName FROM customer WHERE customerID NOT IN (SELECT DISTINCT customerID FROM Invoice);

Sanga and the team : We are proud of you guys

When our cricket team looses, most of the times we used to criticise them. But this T20 World Cup final was one of the rare occasions we feel proud about the team despite the loss. The passion and the spirit the whole team showed through out the tournament was outstanding. There was always someone who stood up and took the responsibility either in batting or bowling. I am really proud of them and whole world would never forget specially how Dilshan, Sanath, Sanga, Mahela, Murali, Mendis, Mathews and Malinga played in this tournament. You all have made Sri Lanka proud. Cheers to all of you guys!!!!

How Indian Cricket fans can show their anger in a peaceful manner

This is an innovative thinking from Nishi Narayanan from Cricinfo. But as we all know Indian supports are the last in the line to accept these kind of CIVILISED ways.

1. Send an anonymous tip to airport authorities regarding possible swine flu among the Indian team contingent. Getting them quarantined will be much more satisfying than breaking a few windows.

2. Hold a press conference. Have all aggrieved Indian fans stand on a stage behind Bishan Bedi, who will read out a hand-written letter telling the players what a bunch of wusses they are for not staging a walkout to protest the short-ball barrage by England.

3. Don't bawl or cry foul murder when reporters stick their mikes into your faces asking for reactions. Be cool. How do I feel now that India have exited the World Twenty20? A little constipated, but I think that's the Chinese takeout from last night.

4. Threaten to support England in the next tournament in that country. The concept of English grounds being filled by thousands of fans cheering for England is bizarre enough to mess the minds of the Indian players so much that they'll need John Buchanan to explain it to them.

5. Invite the players to parade in an open-top bus through the streets of Mumbai as a we-forgive-you gesture. If they survive the ride in the city's monsoons, organise a function for them to watch their post-match interviews where every "obviously" and "of course" is replaced by the sound of nails on a chalkboard.

6. Spread a rumour through the press that Shahrukh Khan plans to buy the whole team for his franchise. If the thought of playing for Kolkata Knight Riders doesn't depress them, the fear of fakeiplplayer leaking all their dirty secrets will surely get to them.

7. And finally, do as Gandhi would. Boycott products endorsed by cricketers. Don't buy shampoos, soaps, cellphones, colas, water, satellite TV, motorbikes, cars, clothes, electricity, chocolate, chips, air conditioners and refrigerators. That leaves books and maybe air. A refreshing and uplifting lifestyle. The Mahatma would approve.

LINK

BBC and Mahinda Rajapakshe

I was reading the news in BBC website on yesterday's (03rd June 2009) celebrations in Colombo. It really made me feel better, purly because the tone that artical was written. It makes the sound of a nation who are really hurt. Mahinda you ROCKS. Keep it up!

http://news.bbc.co.uk/1/hi/world/south_asia/8080626.stm
 
Blog Directory - OnToplist.com