Take two of the same values for two fields in a MySQL table

Source: Internet
Author: User

Looks a little bit around the mouth, for instance,

Two tables with different field names
Field GS and another table GSMC some of the values are the same

All we have to do is find the same value.

Will write this SQL statement can be

Just write the key.

$sql 2= "Select GS from Yixiangkh where GS in (select GSMC from Qiandan)" ; //Execution    $result 2=$db->query ($sql 2, 0); //Fetch Data  $attr 2=$result 2-Fetch_all ();//var_dump ($attr 2[0][0]); foreach($attr 2  as $v)    {              Echo"<div style= ' color:red ' > where "$v[0] "Signed!" </div>";}

This will allow the output to be successful.

If there are different users like me who have logged in, such as this

The maintainer is the one who logged in, the SQL statement can be written like this

$sql 2 = "Select GS from Yixiangkh where  whr = ' {$xm} ' and GS in (select GSMC from Qiandan)";

Of course, the $XM here are here.

Should be able to understand, do not understand can be private chat, hope to help you

Take two of the same values for two fields in a MySQL table

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.