Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. mjmabee

    Where clause not properly excluding records in one-to-many join query

    I figured it out ! Here it is: select i.id, e.code from dbo.hExceptionitem ei, dbo.hItem i, dbo.hException e where ei.batchnumber = i.batchnumber and ei.processingdate = i.processingdate and ei.itemrow = i.rownumber and ei.processingdate = e.processingdate and...
  2. mjmabee

    Where clause not properly excluding records in one-to-many join query

    Although i know there's a problem with this query: select i.id , e.code from dbo.hExceptionitem ei ,dbo.hItem i , dbo.hException e Where ei.batchnumber = i.batchnumber and ei.processingdate = i.processingdate and ei.itemrow = i.rownumber and...
  3. mjmabee

    Where clause not properly excluding records in one-to-many join query

    Your wording "then you have limited your output to only records with that exception code" is exactly right. e.code IN ('18','1018','7018') DOES limit OUTPUT to only those records that have an '18','1018', or '7018' in the e.code field. The problem is that some of the records that are included in...
  4. mjmabee

    Where clause not properly excluding records in one-to-many join query

    Sorry to take so long getting back, I have had a busy day so far ! Marc, the recordsets from both of your queries were identical. They include: 1st Record: i.id:1DDA610116088299.0000000000004105489154 i.amt:299.00 i.batchnumber:8826 i.processingdate:11/01/2006 i.rownumber:2612...
  5. mjmabee

    Where clause not properly excluding records in one-to-many join query

    I mean... and b.id = i.id)
  6. mjmabee

    Where clause not properly excluding records in one-to-many join query

    OK.. note to self mostly, but here's what i'm going to try on Monday... select i.id , e.code from dbo.hExceptionitem ei ,dbo.hItem i , dbo.hException e Where ei.batchnumber = i.batchnumber and ei.processingdate = i.processingdate and ei.itemrow = i.rownumber...
  7. mjmabee

    Where clause not properly excluding records in one-to-many join query

    Wow, I don't know... i wrote up this query (which is an extension on Marc's idea), and thought for sure it would do the trick. It returned no records, but i the logic makes so much sense to me !!! this is driving me crazy. select i.id , e.code from dbo.hExceptionitem ei ,dbo.hItem i ...
  8. mjmabee

    Where clause not properly excluding records in one-to-many join query

    The reason i care about other exception codes is: I'll be using a separate, simpler query to grab a bunch of items, including those that have codes '18', '1018', or '7018' as well as any other codes. The query we're working on here has to select only those items that have only an exception...
  9. mjmabee

    Where clause not properly excluding records in one-to-many join query

    Oh, man, i could scream ! I really thought you had nailed it when i first looked at the result set. Unfortunately, your statement is giving the same results as this one: select i.amt, e.code from (dbo.hExceptionitem ei join dbo.hItem i on (ei.batchnumber = i.batchnumber) and...
  10. mjmabee

    Where clause not properly excluding records in one-to-many join query

    Hi Marc, does that clarify, or do you need more explanation ? Thanks !
  11. mjmabee

    Where clause not properly excluding records in one-to-many join query

    Hmm. I'm not dismissing what you're saying, but i also don't see the conflict... let's look strictly at the last couple parts of the where clause for a minute: (e.code in ('18','1018','7018')) AND ( E.CODE NOT BETWEEN '1' AND '17' AND E.CODE NOT BETWEEN '19' AND '75') AND ( E.CODE...
  12. mjmabee

    Where clause not properly excluding records in one-to-many join query

    ?? Did you want me to remove the entire where clause ? I'm not able to do that because of the size of the database (i risk crashing a production application with queries that are too demanding). i think you were asking just to eliminate some of the requirements... so, i used the following...
  13. mjmabee

    Where clause not properly excluding records in one-to-many join query

    Thanks Marc, I'm at home right now, and I won't have a chance to test this until tomorrow when i'm at work again tomorrow. i'll check it out then, and i'll post back asap. Jake
  14. mjmabee

    Where clause not properly excluding records in one-to-many join query

    dbo is the database owner's name. The database i am working with here is DB2 UDB (7.2 to be exact). The between operand does work with strings... i tested it in a separate query that only used those expressions as criteria, and it did return the records i expected.
  15. mjmabee

    Where clause not properly excluding records in one-to-many join query

    Hmmm.. this is interesting. I tried using "e.code='1018'", and got no records at all. In fact, the DB2 UDB prompt i'm running the query from flies through all iterations of the query (i'm running a loop to retrieve variable values in the date and i.num fields) in under a second. When i use...
  16. mjmabee

    Where clause not properly excluding records in one-to-many join query

    I am trying to write a query that will select records from a primary table when they meet two criteria conditions in that table and their associated records in the foreign key table match ONLY to one of the three values. The foreign key table can contain up to three records matching back to the...

Part and Inventory Search

Back
Top