Subject | Re: [firebird-support] Loosely Coupled Properties with Implicit Defaults |
---|---|
Author | Milan Babuskov |
Post date | 2006-08-02T15:16:35Z |
robert_difalco wrote:
select s.*
from subject s
left outer join sprop p on p.ref_id = s.id
where p.type = 'COLOR' and (p.value = 'ORANGE' or p.value is null)
That query would list all subject that have ORANGE or don't have any
property.
Looking for subject with non-default GREEN color:
select s.*
from subject s
join sprop p on p.ref_id = s.id
where p.type = 'COLOR' and p.value = 'GREEN'
--
Milan Babuskov
http://swoes.blogspot.com/
http://www.flamerobin.org
> The problem is that there could be millions of rows in the SubjectYou don't have to.
> table and only some of them might have a COLOR property other than the
> default of Orange. I don't want to create a row in the string_property
> table for each Subject with the COLOR of Orange.
> So the question is this. How do I query for Subjects that have aFor example: looking for subject with default ORANGE color?
> Property that matches some arbitrary condition. The condition may or
> may not match the default property value.
select s.*
from subject s
left outer join sprop p on p.ref_id = s.id
where p.type = 'COLOR' and (p.value = 'ORANGE' or p.value is null)
That query would list all subject that have ORANGE or don't have any
property.
Looking for subject with non-default GREEN color:
select s.*
from subject s
join sprop p on p.ref_id = s.id
where p.type = 'COLOR' and p.value = 'GREEN'
--
Milan Babuskov
http://swoes.blogspot.com/
http://www.flamerobin.org