Autor Beitrag
uranop
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 149

Win XP, Win 7, Slackware 11, FreeBSD
D6E, php
BeitragVerfasst: Do 23.07.09 22:46 
Tach auch ( ja ich schon wieder xD ),

Ich bin grade dabei zu überlegen wie ich wohl folgenden Schritt bewerkstelligen soll.

also in php ist das easy ...

Pseudocode :
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
$result = select hostid from aufwand

while ($row = mysql_fetch_array($result)) {

$result2 = select hostid from pauschale

while ($row2 = mysql_fetch_array($result2)) { 

if $row[hostid] == $row2[hostid] {

echo $row[hostid] ist in pauschale aufgenommen worden... bitte löschen
}}}


so..
nun möchte ich das gleiche in delphi auch machen.
der soll erst tabelle A durch gehen. Dann tabelle B .
Dann alles Doppelte auflisten, sollte etwas da sein ,
und denn die option geben das doppelte ausm aufwand zu killen ....

irgendwie bekomm ich das mit den Zeos abfragen nicht so verschachtelt hin.

geht das irgendwie zu lösen ?

_________________
Mein worst case: Mir fehlt das Feuerzeug und das Pad für die Senseo
jfheins
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 918
Erhaltene Danke: 158

Win 10
VS 2013, VS2015
BeitragVerfasst: Do 23.07.09 22:53 
Wie wäre es mit einer Abfrage:
ausblenden SQL-Anweisung
1:
select aufwand.hostid as aid, pauschale.hostid as bid from aufwand, pauschale where aid=bid					

und du bekommt die id's zurück, die in beiden Tabellen drin sind ;)
uranop Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 149

Win XP, Win 7, Slackware 11, FreeBSD
D6E, php
BeitragVerfasst: Do 23.07.09 22:56 
NARF manchmal bis ich nen holzkopp ... ich bin ums verrecken ned drauf gekommen wieso auch immer XD

Danke !!

EDIT:

etwas modifizieren musste ich die SQL query.

schaut nu so aus:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
s := 'SELECT t1.hostid, t2.hostid FROM aufwand t1, pauschale t2 WHERE t1.hostid = t2.hostid';

    ZQuery2.SQL.Text := s;
    ZQuery2.active := true;


Stellt sich jetzt nur noch die Frage, da ich ja ohne die ZTable arbeite, wie ich etwaige FieldValues in z.b.
das bereits vorhandene Listview reinbekomme ... mmmh

_________________
Mein worst case: Mir fehlt das Feuerzeug und das Pad für die Senseo
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Sa 25.07.09 12:49 
Man kann natürlich auch INTERSECT nehmen ...

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.