MYSQL: Using a join after and AND -


combines several tables in the MYSQL query though, as you can see, I am finally on receipt table I would like to add When I add LEFT JOIN, the query returns an error. Anybody forgot to know the best way to join the receipt table for the remaining queries, if it is a newbie question, thanks!

  Select user_name, expense_category, merchant_name, expense_cost, expense_date, expense_status, receipt_image, expense_comment users, expenses, traders, receipts WHERE ". $ AdminId." = Expenses.admin_id and expenditure.user_id = users.user_id and expenditure.merchant_id = merchants.merchant_id and left zone (receipts) spent on .receipt_id = receipts.receipt_id  

< Div class = "text" itemprop = "text">

There is a clear way to do this, note that I have added an alias for tables for better readability, so that you can use the nickname in the selected statement. Get the column from the appropriate table.

  ex ex on SELECT u.user_name, ex.expense_category, mer.merchant_name, ex.expense_cost, ex.expense_date, ex.expense_status, re.receipt_image, ex.expense_comment user use Aksporms X .user_id = Add merchant merchant on u.user_id mer.merchant_id = ex.merchant_id LEFT JOIN receipts re rereretti_id = on ex.receipt_id where ex.admin_id = '$ adminId'  
< / Html>

Comments

Popular posts from this blog

sql - Find last match with latest inserted name in table -

c# - XML serialize base class without knowing derived class -

ios - Invalid IPA: missing embedded provisioning profile. Are you sure this is an ad hoc? -