"Marco Alting" <ma***@alting-multimedia.nl> wrote in message
news:y8**********************@amsnews02.chello.com ...
.. . .
Now I want to display all nodeowners, but not the duplicates (if
they own multiple nodes).
You SQL for this one should look something like this :
Select Distinct NodeOwner
From table1 t1
, table2 t2
where t1.[ownerID?] = t2.nodeOwner
That will get you all the people that own Nodes, regardless of
how many.
I've tried using DISTINCT, but I do also need the NodeID which
is always unique so I still get all duplicates.
Now you have a problem. If you want Owner /and/ Node, you're
going to get duplication; there's no way around that. If you wanted,
say, a Grouped List of Owners and their Nodes, you'd need
something like this
Select Distinct NodeOwner
, NodeID
From table1 t1
, table2 t2
where t1.[ownerID?] = t2.nodeOwner
Order By t1.[ownerID?]
, t2.nodeID
Then
rsData.Open( [SQL], oDBConnection )
Do While Not rsData.EOF
sCurrentOwner = rsData( "[ownerID?]" ).Value
' [Start] Display Owner
Do While Not rsData.EOF
' Bit of a kludge since VBScript doesn't short-circuit If's
If sCurrentOwner <> rsData( "[ownerID?]" ).Value Then
Exit Do
End If
' Display Node
rsData.MoveNext
Loop
' [End] Display Owner (if, say, you're using HTML tables)
Loop
HTH,
Phill W.