Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AND Statement

Status
Not open for further replies.

crystalfun

Programmer
Feb 8, 2001
39
US
I've been out of programming and back into accounting for over a year so I forget everything. Please help.

I have an Access database with 2 tables. I want to return a value from Table 2. I forget how to write the formula.

If Field 1 and Field 2 from Table 1 = Field 1 and Field 2 from Table 2 then return Field 3 from Tbl 2.

Thanks in advance
 
The SQL Query for that would go like this:

SELECT Table2!Field3 As Field3
FROM Table1, Table2
WHERE Table1!Field1 = Table2!Field1 AND Table1!Field2 = Table2!Field2
 
My SQL statement is a little different. Lets say in Table1 you have 2 records that match Table2 then you may want 2 results not 4.

SELECT DISTINCTROW Table2.Field3
FROM Table1 INNER JOIN Table2 ON (Table1.Field1 = Table2.Field1) AND (Table1.Field2 = Table2.Field2);

Good Luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top