Ver Mensaje Individual
  #6  
Antiguo 05-03-2004
Avatar de StartKill
StartKill StartKill is offline
Miembro
 
Registrado: ene 2004
Posts: 299
Reputación: 21
StartKill Va por buen camino
Hola,

Se pasaron, es increible el poder de de un select usado correctamente, Gracias señores.

Tomando el ejemplo de nuestro amigo "jachguate"

Código:
Select t1.campo1, t1.campo2
    from tabla t1
   where t1.campo1 = (select min(t2.campo1)
                                 from tabla t2
                                where t2.campo2 = t1.campo2)
solo añadi un campo mas al codigo, asi:

Código:
Select t1.campo1, t1.campo2, t1.campo5
    from tabla t1
   where t1.campo1 = (select min(t2.campo1)
                                 from tabla t2
                                where t2.campo2 = t1.campo2)
osea: aumente la columna "campo5" que es la que queria actualizar, obteniendo un cursor como queria.

Les cuento que mientras no sabia como actualizar el "campo5" tuve que ingeniarmelas para conseguir modificar/actualizar el "campo5".

Conseguir actualizar el "campo5" en base a filas unicas por el "campo2" hice una pequeña rutina en delphi que me permitio actualizar el "campo5" mas no obtuve un cursor. , pero sali del apuro

procedure TForm1.Button1Click(Sender: TObject);
Var
__xVar1, xVar2:String;
Begin
__ibtransaction1.Active:=false;
__ibtransaction1.StartTransaction;
__ibquery1.open;
__ibquery1.First;
__xVar1:='__';
__while not ibquery1.Eof do begin
____xVar2:=ibquery1.FieldValues['CAMPO2']
____If xVar1<>xVar2 then Begin
______xVar1:=ibquery1.FieldValues['CAMPO2']
______ibquery1.edit;
______ibquery1.FieldByName('CAMPO5').asString:='Y';
______ibquery1.post;
____end;
____ibquery1.Next;
__end;
__showmessage('Ok...');
end;

Your friend

StartKill
Lima-Perú

Última edición por StartKill fecha: 05-03-2004 a las 20:53:05. Razón: Mal nombre del moderador
Responder Con Cita