What we're going to share with you today is the IN keyword in the SQL statement. The purpose of this in is to display all the data that the field value contains in a collection. field name in collection
If you do not understand, you can slowly realize from the following process. The data source is one of the courses in Basic, CONFERENCE, SAP, and we want to find out the names of both basic and CONFERENCE courses, that is, finding two columns of the same data.
650) this.width=650; "style=" Float:none; "title=" 31.JPG "src=" http://s3.51cto.com/wyfs02/M00/6D/9E/ Wkiol1vn8txjtbs8aagu6ykgq_4043.jpg "alt=" Wkiol1vn8txjtbs8aagu6ykgq_4043.jpg "/>
First create a data connection with OLE DB, and then enter the following SQL statement:
SELECT Basic as ' basicandconference ' with Basicandconference as the column name
from [sheet1$]
where Basic in (Select Conference from [sheet$]) displays the condition with where to control the output of the row, displaying data in the Basic column that also appears in the Conference column
650) this.width=650; "style=" Float:none; "title=" 32.JPG "src=" http://s3.51cto.com/wyfs02/M00/6D/A2/ Wkiom1vn8uegnhecaahcyod6t4a348.jpg "alt=" Wkiom1vn8uegnhecaahcyod6t4a348.jpg "/>
The results are as follows
650) this.width=650; "style=" width:609px;float:none;height:231px; "title=" 33.JPG "src=" http://s3.51cto.com/wyfs02/ M01/6d/9e/wkiol1vn8u3jk9r1aaiqasrrz0g656.jpg "width=" 415 "height=" 161 "alt=" wkiol1vn8u3jk9r1aaiqasrrz0g656.jpg "/ >
This article is from the "Guo Yong Technology blog" blog, make sure to keep this source http://guoyong.blog.51cto.com/408495/1656287
Querying data using SQL statements in Excel (vi) Application of-----in statement