mysql - How can I pull multiple user info from one query? -


After

I have an invoice table that contains the ID that the user has sent the invoice ( from_id ) and The user has received the invoice ( to_id ).

I want to be able to pull both of my information from the profile table, but I am unable to figure out how.

The query below, I think, is running because I'm moving information ( from_id ) for just one user joining.

  select jobs .title, profiles.display_name, invoice.to_id, invoice.from_id, join (invoice) jobs on invoice.amount jobs.job_id = invoice.job_id on invoice. From_id = profiles.user_id where `invoice_id` = join the profile '3'    

You can use the same table twice. Give them a different aliased, which makes me think that anyway makes a more readable question.

  Select j.title, tp.display_name, FROM_NAME, i.to_id, i.from_id as fp.display_name, i.amount join invoices from invoices. Join j.job_id = i.job_id on profile fp i.from_id = fp.user_id Join profile tp at i.to_id = tp.user_id Where i.invoice_id = '3'    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -