gnumed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-devel] Medication tweaks


From: Karsten Hilbert
Subject: Re: [Gnumed-devel] Medication tweaks
Date: Tue, 21 Jun 2011 10:33:43 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, Jun 20, 2011 at 08:17:06PM -0700, Jim Busser wrote:

> If it is possible and desirable to provide an atc_code where available, can 
> the form (where it is not available) be a pair of single quotes without any 
> content for example
> 
>       ''
> 
> permitting the following, or must the INSERT statements for those drugs which 
> lack an ATC code remove the atc_code from the SQL statement?
> 
> INSERT INTO ref.consumable_substance (
>       description,
>       amount,
>       unit,
>       atc_code
> )     SELECT
>               'amoxicillin'::text,
>               '500'::numeric,
>               'mg'::text

There's a , missing here.

>               ''::text

This would need to be:

                NULL::text

better yet:

        (SELECT code FROM ref.atc WHERE term = 'amoxicillin' LIMIT 1)

which will return an ATC if already known or else NULL.

>       WHERE NOT EXISTS (
>               SELECT 1 FROM ref.consumable_substance
>               WHERE
>                       description = 'amoxicillin'
>                               AND
>                       amount = '500'
>                               AND
>                       unit = 'mg'
>       );

Karsten
-- 
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346



reply via email to

[Prev in Thread] Current Thread [Next in Thread]