SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Threaded View

  1. #1
    SitePoint Zealot erikwebb's Avatar
    Join Date
    Dec 2003
    Location
    Atlanta, GA
    Posts
    150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [RESOLVED] Using a Field Multiple Times in One Statement?

    I am working on a ticketing system and need to pull the same field from a table twice. In my ticket table there is a field that links to the creator's contact ID as well as the assigned person's contact ID. Basically, both of these link to the ID field in the contact table. Doing this connection is not the problem. I need to pull out <contact table>.name twice, once for each ID (creator, assigned). MySQL is pulling only one of the names, and is simply displaying it twice. A sample of what I have so far is below:
    Code:
    SELECT B.name, B.name AS assignee 
       FROM ticket A, contacts B 
       LEFT JOIN B ON A.assigned_id=B.id 
       WHERE A.creator_id=B.id
    Last edited by erikwebb; Feb 3, 2006 at 13:32.


Bookmarks

Posting Permissions

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