[prog] Sql query
Conor Daly
conor.daly-linuxchix at cod.homelinux.org
Tue Jul 12 23:27:17 EST 2005
On Tue, Jul 12, 2005 at 01:25:28PM +0200 or so it is rumoured hereabouts,
Tiera thought:
>
> I forgot to mention that I also need to be able pick out the products that
> have a special status at the moment. I think I'll just put a status field
> in the product table also and keep that up to date with the changes in the
> period table. Seems like the easiest solution at the moment.
May seem easy now but it'll be a big headache down the line. Any
redundant data means extra ongoing maintenance. It would be better to get
familiar with all the complex queries you can do such as:
select * from product, period where
product.id = period.productid
and
(period.enddate is null or period.status = 'Special')
Which will allow both in one query...
Conor
--
Conor Daly <conor.daly at oceanfree.net>
Domestic Sysadmin :-)
---------------------
Hobbiton.cod.ie
14:24:12 up 5 days, 17:18, 1 user, load average: 0.00, 0.00, 0.00
More information about the Programming
mailing list