[Zope-DB] how to complement a result set

Fejes Róbert pouch at freemail.hu
Tue Mar 9 06:07:11 EST 2004


Cheers,

Let's say, I've got the following tables (MySQL 4.0.15):

costs (c_id int not null primary key, c_name varchar(255) not null)
months (m_id int not null primary key, m_name varchar(255) not null)
mc (c_id int not null, m_id int not null, cost int)

//mc.c_id and mc.m_id are foreign keys

There are 12 months:) 9 of them have not passed. The result of the
'select m_name, c_name from costs, months, mc
where costs.c_id = mc.c_id and
         months.m_id = mc.m_id;'
statement can be formatted in a web page to look like this:
01 gas, rent, water
02 rent, water
03 insurance, gas, rent, water

How to complement this result set to have a full list? 

01 gas, rent, water
02 rent, water
03 insurance, gas, rent, water
04 not available yet
05 not available yet
...
11 not available yet
12 not available yet

I'm using zope 2.6.1-132. <dtml-var c_name null="n/a"> or <dtml-var c_name 
missing="n/a"> did not do the trick. Is it a question of SQL and/or 
<dtml ...> staff and/or scripting in Python?

How would you solve this?

Thank you very much, indeed.
-- 
Bye: FeRó
//SuSE 9.0 - a most foolproof OS






More information about the Zope-DB mailing list