home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / database / sybase / 510 < prev    next >
Encoding:
Internet Message Format  |  1992-12-20  |  1.3 KB

  1. Path: sparky!uunet!pipex!doc.ic.ac.uk!agate!ucbvax!mtxinu!sybase!robert
  2. From: robert (Robert Garvey)
  3. Newsgroups: comp.databases.sybase
  4. Subject: Re: Comparing two columns in two tables
  5. Keywords: not exists
  6. Message-ID: <27155@sybase.sybase.com>
  7. Date: 15 Dec 92 20:33:59 GMT
  8. References: <1992Dec3.233316.25194@muug.mb.ca>
  9. Sender: news@Sybase.COM
  10. Distribution: comp.databases.sybase
  11. Organization: Emeryville Tupleware, Party Planning Division
  12. Lines: 21
  13.  
  14. In article <1992Dec3.233316.25194@muug.mb.ca>, dmenns@muug.mb.ca (Darren Enns) writes:
  15. |> I hope someone could suggest some nifty SQL to solve a
  16. |> situation I have.  assume two tables with two columns each -- I want to
  17. |> verify that all column pairs in one table occur at least once as a pair
  18. |> in the other table.  
  19.  
  20. |> It seems to me that
  21. |> there should be a way to do this in SQL -- all I can think of is the code
  22. |> necessary to prove that a violation exists, but not *where* it does.
  23. |> Thanx for any help.
  24.  
  25. SELECT x.e, x.f FROM x
  26. WHERE NOT EXISTS ( SELECT * FROM y
  27.            WHERE y.e = x.e
  28.            AND y.f = x.f )
  29.  
  30. -- 
  31. Robert Garvey robert@sybase.com {sun,lll-tis,pyramid,pacbell}!sybase!robert
  32.           Sybase, Inc   6475 Christie Ave   Emeryville, CA   94608-1010
  33.  
  34. If Sybase were to pay employees for their opinions, they couldn't afford me.
  35.