M.P.Dankoor wrote:
> devil live wrote:
>> how can I write a query to get right ingredients of a product basis on
>> production_no field
>>
>> such as;
>>
>> first check production_no if product_tree_special table if not found
>> then look at template table...
>>
>> What are your suggestions?
>>
I
On 1/11/07, devil live <[EMAIL PROTECTED]> wrote:
NOW : product_tree_template table is the default table for production
ingredients of the PRODUCT
but sometimes my customer using special product_tree table for some
production_no
how can I write a query to get right ingredients of a product bas
I think that the simplest solution is to use an union e.g:
select PRD.product_code
,PRD.product_name
,NULL::intAS production_no
,PTT.stock_code_to_make_product
,PTT.amount
from product PRD
,product_tree_template PTT
where 1 = 1
AND PRD.product_code = PTT.
I want to write sql statement about product, product_tree_special,
product_tree_template
product has
product_code varchar(20) PRIMARY KEY,
product_name varchar(20)
product_tree_template has
product_code varchar(20) PK,
stock_code_to_make_product(20) PK,
amout float4
product_tree_spci
OK, I solved my own problems (Congrats ;-) Sorry for bothering the list.
This is what I'm doing:
INSERT INTO table SELECT x,x,x where (select count(*) from table where
col1='value')=0;
any suggestions?
thanks,
Indraneel
On Mon, 6 Nov 2000, Indraneel Majumdar wrote:
> Now I have one more probl
>
> Now I have one more problem. How do I insert only once if value does not
> exist? eg:
>
You should create a unique index on the appropriate fields. For example:
CREATE UNIQUE INDEX indexname ON table (field1, field2)
Then the insert will fail if this particular combination of the values of
I finally got it to work. you can't use the parentheses. eg:
insert into table select x,x,x where col1 = 'value';
and not
insert into table select (x,x,x) where col1 = 'value';
the latter gives a
ERROR: parser: parse error at or near "where"
I am using PostgreSQL-7.0.2
Now I have one more prob
> > insert into table select ... where col1 = 'value'
> >
>
> this is working but I am inserting values directly and not by select. eg:
>
> insert into table values(x,x,x)
> and not
> insert into table select * from table2
>
insert into table select (x, x, x) where col1 = 'value'
On Sun, 5 Nov 2000, Marten Feldtmann wrote:
> Indraneel Majumdar schrieb:
> >
> > Hi,
> >
> > how can I insert a record after checking whether one of the fields has a
> > certain value or not? eg:
> >
> > if table(col1)='value' insert into table values (x,x,x)
> >
> > I am using perl interfac
Hi,
how can I insert a record after checking whether one of the fields has a
certain value or not? eg:
if table(col1)='value' insert into table values (x,x,x)
I am using perl interface. Is there any way to define a function to take
table name as an argument? (eg: select * from $table) I tried b
10 matches
Mail list logo