Opened 14 years ago

Closed 14 years ago

Last modified 7 years ago

#75 closed task (fixed)

réintegrarion des numeros d'operation dans station

Reported by: cedric Owned by: cedric
Priority: major Milestone:
Component: SIG-data Version: EDA2.0
Keywords: Cc:

Description (last modified by cedric)

select * from wrbd.fish_fi left join (select * from wrbd.operation_op where op_nbtotal>0)as ope 
on (fi_date,fi_st_id)=(ope.op_date,ope.op_st_id)  
except (
select distinct on (fi_id) * from(
select * from wrbd.fish_fi left join (select * from wrbd.operation_op where op_nbtotal>0)as ope 
on (fi_date,fi_st_id)=(ope.op_date,ope.op_st_id) ) as sub)
 --2357
alter table wrbd.fish_fi add column fi_op_id integer;
-- generation du script d'insert à sauvegarder dans fish_update.txt (je passe au inner join pour ne pas avoir de lignes vides)
-- il faut ensuite remplacer "" par ' et " par rien dans notepad.
-- il doit y avoir encore mieux mais je ne vois pas
select *
 from wrbd.fish_fi join (select * from wrbd.operation_op where op_nbtotal>0)as ope 
on (fi_date,fi_st_id)=(ope.op_date,ope.op_st_id) 

select 'update wrbd.fish_fi set fi_op_id= ' ||cast(op_id as text)||' where fi_st_id="'||cast(fi_st_id as text)||'";'
 from wrbd.fish_fi join (select * from wrbd.operation_op where op_nbtotal>0)as ope 
on (fi_date,fi_st_id)=(ope.op_date,ope.op_st_id) 
order by fi_id ;  

Attachments (1)

update_fish.sql (132.7 KB) - added by cedric 14 years ago.

Download all attachments as: .zip

Change History (5)

Changed 14 years ago by cedric

comment:1 Changed 14 years ago by cedric

  • Description modified (diff)
  • Resolution set to fixed
  • Status changed from new to closed

comment:2 Changed 14 years ago by cedric

there was a problem at first with operations dates for joining with the operation table.
OK everything solved use sql script

comment:3 Changed 14 years ago by cedric

Corrected script

select 'update wrbd.fish_fi set fi_op_id= '
cast(op_id as text)' where fi_id="'cast(fi_id as text)'";'

from (select * from wrbd.fish_fi ) fi

join (select * from wrbd.operation_op where op_nbtotal>0 and op_folio_no is not null )as ope

on (fi_date,fi_st_id)=(ope.op_date,ope.op_st_id)
order by fi_id ;

comment:4 Changed 7 years ago by cedric

  • Milestone Data integration deleted

Milestone Data integration deleted

Note: See TracTickets for help on using tickets.