Laurence claimed:
| This technique does return the same one twice. Try it.
| AND it's the most generic SQL. It'll work on any SQL database - try using
| intersect in anything but an Oracle database.

looking at the sql example again:

| select Name
| from Table
| where GroupID in (1,7)
| group by Name
| having count(GroupID) = 2;

given the following data, and remember the original stipulation: "Basically,
a person can have any number of attribute ID's (possibly even the same one
twice)."

Smith     1
Smith     1
Jones     1
Jones     7
Jones     7

This query would return the name "Smith" (incorrectly), and not return Jones
(again incorrect)

If the query was changed to "having count(distinct GroupID) then it would
operate correctly, although probably inefficiently compared to other
techniques since you are asking for a count that is largly unnecessary.


---------------------------------------------------------------------------
  New Zealand Delphi Users group - Database List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to