Thursday, December 21, 2006

Follow-up testing pre-tag with Blogger

I always had difficulties showing SQL statements on my Blog. At the blogger meet-up at OOW I talked with Eddy (Awad) about this and he told me to test the pre- and code-tag. So, finally, today I tested it (again) and apparently it works. Also thanks to Patrick Wolf to give me a css for the pre-tag.

I also noticed that Beta Blogger became Blogger (2). Great!

A statement without the pre-tag:

SELECT t.team_name, t.team_id FROM tdg_team t, (SELECT r.team_id, rank() over (PARTITION BY r.team_group_id ORDER BY r.points DESC, r.matches_won DESC, r.goals_difference DESC, r.goals_scored DESC) team_rank FROM tdg_match_rank r WHERE r.tournament_id = :TDG_AI_TOURNAMENT_ID) rt WHERE t.team_id = rt.team_id AND rt.team_rank IN (1,2);

A statement with the pre-tag:

SELECT t.team_name, t.team_id
FROM tdg_team t,
(SELECT r.team_id, rank() over (PARTITION BY r.team_group_id
ORDER BY r.points DESC, r.matches_won DESC,
r.goals_difference DESC, r.goals_scored DESC) team_rank
FROM tdg_match_rank r
WHERE r.tournament_id = :TDG_AI_TOURNAMENT_ID) rt
WHERE t.team_id = rt.team_id
AND rt.team_rank IN (1,2);
A statement with the pre- and code-tag:

SELECT t.team_name, t.team_id
FROM tdg_team t,
(SELECT r.team_id, rank() over (PARTITION BY r.team_group_id
ORDER BY r.points DESC, r.matches_won DESC,
r.goals_difference DESC, r.goals_scored DESC) team_rank
FROM tdg_match_rank r
WHERE r.tournament_id = :TDG_AI_TOURNAMENT_ID) rt
WHERE t.team_id = rt.team_id
AND rt.team_rank IN (1,2);

2 comments:

Eddie Awad said...

It works indeed and looks pretty good!

Joe said...

Good tip.

The strange thing is, if you switch back and forth between the "Edit HTML" and "Compose" views of Blogger's editor, leading spaces inside a "pre" block sometimes get removed. It's very frustrating, especially when you are trying to post snippets of Java code to your blog.

I wish Blogger's editor had a pseudo "code tag" like many of the internet forums have. I say "pseudo" because it uses square brackets (e.g. [code]some code[/code]) and gets interpreted into HTML by the editor. I have asked Blogger for this!