Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2004
    Posts
    20

    Unanswered: Help if possible

    I have very limited skill in Access, but am working on a project for work. I have a database file that includes fields like item number and ticket number. There are currently identical records for both of these fields. I'm trying to create a query that dislplays a specific item only if it has the same ticket number as any other item.

    I'm not sure if I explained this the best, but any help would be greatly appreciated.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Code:
    select t1.itemnumber
         , t1.ticketnumber
      from yourtable as t1
    inner
      join yourtable as t2
        on t1.ticketnumber
         = t2.ticketnumber
       and t1.itemnumber
        <> t2.itemnumber
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jun 2004
    Posts
    20
    I tried that code and it didn't work right, but maybe it's because I forgot to explain something in full detail. I'm looking to display the ticket number in which an itemnum 8999 was sold, but another itemnum was sold on that same ticket.

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Code:
    select t2.itemnumber
         , t1.ticketnumber
      from yourtable as t1
    inner
      join yourtable as t2
        on t1.ticketnumber
         = t2.ticketnumber
       and t1.itemnumber
        <> t2.itemnumber
     where t1.itemnumber = 8999
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •