Archive for July, 2009

TSQL Challenge #11 Using Recursive CTE

Add a comment

Here is my proposal about the TSQL Challenge #11.

Given a product table, and a coupon table, we have to find within one or two coupons which combination gives the best discount, with additional rules :

  • the discount price can not be less than 70% of the original price
  • the total amount of the discount can not exceed 30$

Here are the products :

ID NAME    PRICE
-- ------- ---------
1  PROD 1  100,00
2  PROD 2  220,00
3  PROD 3  15,00
4  PROD 4  70,00
5  PROD 5  150,00

And the coupons : Continue reading 'TSQL Challenge #11 Using Recursive CTE'

NoCOUG Got Nine, TSQL Got Eleven

Add a comment

NoCOUG

Well, I'm not really comparing comparable numbers here.

The NoCOUG last submit date was the last day of june, and therefore it is past.
Iggy Fernandez wrote about the nine different solutions he received (I very like the title he has chosen) !

I'm the seventh in the list there.
As I told before, my favorite solution to this problem is André Aurajo's one.

Alberto Dell’Era wrote an Continue reading 'NoCOUG Got Nine, TSQL Got Eleven'

Oracle KEEP function Order By Keyword

Add a comment

I found something funny with the Oracle Keep / { First - Last } analytic function, on 11.0.0.6 & 11.0.0.7.
Same thing occurs also on Oracle 10g XE.

For those who don't have a clue about this function, I wrote a small post on this subject.

Continue reading 'Oracle KEEP function Order By Keyword'

Is Distinct A Synonym To Order By In MS SQL Server ?

1 Comment

This afternoon, I was chatting with Antoine Gémis about T-SQL, and this subject came on the table.

He was asking if, in my opinion, using both a distinct and an order by in the same statement would make the query worst due to the fact that distinct is already performing a sort on his own.

Working mostly with Oracle, and being sure distinct is not doing any sort, this was my first answer : "As far as I know, distinct is not performing any sort".

Continue reading 'Is Distinct A Synonym To Order By In MS SQL Server ?'

Theme Tweaks, Tag Cumulus, Twitter !

Add a comment

Theme Tweaks

Since I've upgraded this weblog to WordPress 2.8, I've been involved into opening the php files of this RGB theme to make some tweaks.

After 2.8, my sidebar was frozen. As it is an essential part of the theme, I decided to look for another one, which I did fairly quickly with greyville.

Even if I was missing the colorset, I was really enjoyed by the readability of the new theme and some options in the sidebar.
In the same time, Ozh was fixing the RGB sidebar issue.

Continue reading 'Theme Tweaks, Tag Cumulus, Twitter !'