home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / database / 8039 < prev    next >
Encoding:
Internet Message Format  |  1992-11-23  |  1.4 KB

  1. Xref: sparky comp.databases:8039 comp.databases.ingres:1963
  2. Newsgroups: comp.databases,comp.databases.ingres
  3. Path: sparky!uunet!dcatlas!sethg
  4. From: sethg@dcatlas.dot.gov (Seth Grimes)
  5. Subject: Re: SQL Query and a QUEL query
  6. Message-ID: <1992Nov23.134505.973@dcatlas.dot.gov>
  7. Organization: U.S Dept. of Transportation
  8. References: <13NOV199213095729@erich.triumf.ca> <1992Nov16.183201.13342@oracle.us.oracle.com> <1992Nov19.191535.17846@cs.rochester.edu> <1992Nov20.225217.19430@athena.mit.edu>
  9. Date: Mon, 23 Nov 1992 13:45:05 GMT
  10. Lines: 23
  11.  
  12. thomasl@mtl.mit.edu (Thomas J Lohman) writes:
  13.  
  14. >I want to select all entries of a table like so based on some
  15. >qualifications:
  16.  
  17. >select ta1.name from table1 ta1, table2 ta2 where ((ta1.id = ta2.id
  18. >and ta2.string = "testing" and ta2.sequence = 1) and (ta1.id = ta2.id and
  19. >ta2.string = "testing2" and ta2.sequence = 2))
  20.  
  21. Well, first of all, the ta1.id=ta2.id is given twice and second of all,
  22. more importantly, you'll get a null return because you have
  23. "ta2.sequence=1 and ta2.sequence=2" and same for ta2.sequence in your 
  24. where clause.  Maybe you meant "or" in the middle of the where and not
  25. "and".  Assuming you did, you could render this in QUEL (if memory
  26. serves me correctly) as
  27.  
  28. range of ta1 is table1
  29. range of ta2 is table2
  30. retrieve (ta1.name) where [same clause, corrected, as above]
  31.  
  32. Oh, I notice your SQL select should have ' instead of ".
  33.  
  34. Seth Grimes, dcatlas!sethg@uunet.uu.net
  35.