Delphi-PRAXiS
Seite 3 von 3     123   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Datenbanken (https://www.delphipraxis.net/15-datenbanken/)
-   -   Delphi SQL-Anfrage aus anderer Tabelle bilden (https://www.delphipraxis.net/25187-sql-anfrage-aus-anderer-tabelle-bilden.html)

Luciano 5. Jul 2004 15:41

Re: SQL-Anfrage aus anderer Tabelle bilden
 
Ich wollte einfach mal eine unreife Lösung posten für mein Problem, zumindest funktioniert es

Delphi-Quellcode:
  while not DModFakturierung.Q_FFAKTRELA.Eof = True do
    begin
      rela1[z]   := StrToInt(DModFakturierung.Q_FFAKTRELARelation1.Value);
      DModFakturierung.Q_FFAKTRELA.Next;
      inc(z);
    end;

  for i := 0 to (y - 1) do
    begin
      if i = 0 then
        begin
          sRela1 := IntToStr(rela1[i]);
          s1 := '(RELATION = '+QuotedStr(sRela1)+') ';
        end;

      if i > 0 then
        begin
          sRela1 := IntToStr(rela1[i]);
          s1 := 'OR (RELATION = '+QuotedStr(sRela1)+') '
        end;
          s := s + s1;
    end;//END FOR Schleife

  Result := 'AND ('+s+')';

Greets

Luciano

ibp 5. Jul 2004 16:41

Re: SQL-Anfrage aus anderer Tabelle bilden
 
... wie wäre es damit um doppelte zu filtern...

Delphi-Quellcode:
procedure ....

var a: array of integer;
    i,j,anz: integer;

begin
  while not DModFakturierung.Q_FFAKTRELA.Eof do
  begin
    i:=StrToInt(DModFakturierung.Q_FFAKTRELARelation1.Value);
    anz:=length(a); // anzahl der element
    if i>=anz then
    begin
      setlength(a,i+1); // anzahl vergrößern
      for j:=anz to i do
        a[j]:=0; // intialisieren
    end; // if
    inc(a[i]); // diese zahl zufügen
    DModFakturierung.Q_FFAKTRELA.Next;
  end; // while

  for i:=0 to length(a)-1 do
    if a[i]=1 then showmessage(inttostr(i)+' ist nur einmal vorhanden');
end;

[edit] falls 0 auch vorhanden ist, dann intialisiere und frage ab auf -1[/edit]

Luciano 6. Jul 2004 09:36

Re: SQL-Anfrage aus anderer Tabelle bilden
 
Hi ibp

Thx, ich werde es mal bei Gelegenheit testen, bin etwas unter Zeitdruck... :? und muß mal etwas lauffähiges vorzeigen, optimieren kann ich dann immer noch.

Greets

Luciano


Alle Zeitangaben in WEZ +1. Es ist jetzt 12:10 Uhr.
Seite 3 von 3     123   

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz