• Join Us |
  • |
  • Sign in with:

Evening Reading

by Steve Gibson, Jan 12, 2007 6:00pm PST
Related Topics – Wack News

Enjoy the weekend girls. When you're finished up and gonna bury the body make sure to go more than a couple of feet deep. Thats just lazy.

- CES winners? - Robots to watch and shoot lasers at Canadians - Dude, lost rover - $100 laptop perhaps public?
Lastly, you remember college?































  • SQL experts

    Anyone know if there is an isNull function in postgresql? It's such a useful function and i've used it a 1000 times on sql server. basically the method takes 2 args

    isNull(column, defaultValue) and basically says "if this value is null, return the default value"

    here's my problem:


    select ideas.*, ratings.average_rating
    FROM ideas
    LEFT JOIN (select ratings.rateable_id, ratings.rateable_type, sum(ratings.rating) / CAST(count(ratings.*) as float) as average_rating
    FROM ratings
    GROUP BY ratings.rateable_id, ratings.rateable_type) ratings on ratings.rateable_id = ideas.id AND ratings.rateable_type = 'Idea'
    ORDER BY ratings.average_rating DESC


    I need ratings.average_rating to be 0 if there are no ratings.. currently it's returning as null.