An issue in the database where one table data is known to query another table data

Source: Internet
Author: User
Tags joins
From Tb_xmpcps can find the user name $myrow2[' xmpcps_user '], and then through the user name to find the name in Tb_user, two table nested query is really the first time to do, labor everyone pointing! Why is there a mistake in saying $query2?
   
 
        
  
   .    
 
  


Reply to discussion (solution)

Try connecting the table
SELECT b.* from Tb_xmpcps as A left Ouver joins Tb_user as B on A.xmpcps_user=b.online_user WHERE a.xmpcps_pcid= ' $xmpc _id '

$query 2=mssql_query ("Select b.* from Tb_xmpcps as A left OUTER joins Tb_user as B on A.xmpcps_user=b.online_user WHERE a.xm Pcps_pcid= ' {$xmpc _id} ');

or an error? Why? Say $query2 has a mistake? Please help me look again!

   
 
        
  
   .
 
      
 
      
  
          
 
  

Echo Mssql_get_last_message ();
Let's see what we got.

I ended up with two nested queries to solve, so you can, or thank you for your help!

   
 
        
  
   .    
 
  
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.