Thursday July 22, 2004 select substring(w.name,1,50) as weblog_name, substring(e.title,1,50) as entry_title, u.username as author, e.pubtime as raw_date, date_format(e.pubtime,'%M %e %H:%i') as pubtime, count(c.id) as comment_count from weblogentry as e, website as w, rolleruser as u left join comment as c on c.entryid = e.id where e.publishentry = 1 and e.pubtime <= CURRENT_TIMESTAMP and w.id = e.websiteid and u.id = w.userid group by e.id order by weblog_name, raw_date descI am always at my happiest when coding SQL - can't explain it, perhaps its the feeling of buring more CPU cyles per character of code than anything else I write. I then use a sorting class designed by Matthew to order the results - wouldn't have needed it with Oracle at my disposal, but when MySql gets views in v5.0 it will do the trick.
I wanted to add the category for each post, but that would naturally invite sorting and since I am displaying two posts per blogger, that would result in two different categories per row - and present a weird sorting experience.
I welcome any comments on the design and or ideas on new metrics.
(2004-07-22 16:10:31.0)
Permalink
Comments [5]
Posted by Derek on July 22, 2004 at 07:45 PM PDT #
I just did a quick search on PostGres docs, it looks like the only schema change would be to alter the MySql tinyint to PostGres smallint.
Now that we have to support both Oracle and MySql, I doubt anyone is interested in introducing PostGres to the mix - however it looks like migrating from MySql to PostGres is alot simpler than migration from MySql to Oracle.
Posted by hoffie on July 22, 2004 at 09:24 PM PDT #
Posted by Lance on July 23, 2004 at 07:13 AM PDT #
Posted by Dave Johnson on August 04, 2004 at 07:39 PM PDT #
Posted by hoffie on August 06, 2004 at 02:21 PM PDT #