ASP SELECT JOIN
Category: Network Programming Update Date: 2004-2-8 22:41:48 Reading: 353 Join Join Connecting Field Records in Two Tables, including three: inner Join operations: connection combination two tables Field records. LEFT JOIN Operation: Connect the field record in two tables, and will contain all records in the left table of the left table. Right Join Operation: Connect the field record in the two tables, and will contain all the records in the right table in Right Join. INNER JOIN Sets two table-related operations to connect to the field records in two tables. The Inner Join syntax is as follows: from table 1 INNER JOIN Table 2 ON Table 1. Field 1 Compare Operator Table 2. Field 2 Two Table Connection Fields, such as [Table 1. Field 1 = Table 2. Field 2], must have The same field type, but the field name does not require the same. For example, the automatic number field type can connect to the field type of the LONG, but the single-intensity of the single field type cannot connect the fiddle-integrated field type. The comparative operation operator can be =, <,>, <=,> =, or <>. The field of the join connection cannot contain the MEMO field type or OLE object type, otherwise an error will occur. In a Join expression, you can connect multiple ON clauses: SELECT FIELDS FROM Table 1 Inner Join table 2 ON Table 1. Field 1 Comparative Operator Table 2. Field 1 And ON Table 1. Field 2 Compare Operator Table 2 Field 2) OR ON Table 1. Field 3 Compare Operator Table 2. Field 3) Join Expression, can be a nest: SELECT FIELDS FROM Table 1 Inner Join (Table 2 Inner Join [(] Table 3 [Inner Join [(] Table X [Inner Join ...) ON Table 3. Field 3 Compare Operator Sub Table X. Field x)] ON Table 2. Field 2 Compare Operator Table 3. Field 3) ON Table 1. Field 1 Comparative Operator Table 2. Field 2 In an Inner Join, the nest-like Left Join or Right Join, but cannot include nest-like INNER JOIN in one Left Join or Right Join. Let us see an example of using this SQL instruction among the ASP program.
You can use Inner Join ... ON to combine records in two tables, such as ASP program RS26.asp, [SELECT sales. Code, product. Name, product. Price, sales. Quantity from sale inner Join product ON product. Code = Sales. Code], use Inner Join ... ON to set two table-related operations, combine the records in two tables: <% set conn1 = server.createObject ("adodb.connection" conn1.open "Dbq =" & server.mappath ("ntopsamp.mdb") & "; driver = {Microsoft Access driver (* .mdb)}; driverid = 25; FIL = MS Access;" SET RS3 = Server.createObject ("adoDB .Recordset ") SQL =" SELECT sales. Code, product. Name, product. Price, sales. Quantity from sale Inner Join Products ON Products. Code = Sales. Code "RS3.Open SQL, CONN1, 1, 1% >