Results 1 to 3 of 3

Thread: [SQL] Getting client names from other table knowing only theirs ids

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Code:
    SELECT p.name, a.name FROM (SELECT client_id, admin_id FROM penalties WHERE ...[your where clause goes here if any]) b INNER JOIN (SELECT name, id FROM clients) a ON (a.id = b.admin_id) INNER JOIN (SELECT name, id FROM clients) p ON b.client_id = p.id
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  2. The Following User Says Thank You to IzNoGoD For This Useful Post:

    RobsoN (22nd March 2014)

Posting Permissions

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