fixed equivalent sql in cookbook