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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I know how to do this in Excel, but...

Status
Not open for further replies.

MisterMan

Technical User
Jun 4, 2002
87
0
0
US
Is there SQL code that is similiar to the Excel Lookup feature? For example, I have an excel sheet that has Codes and District names, and a sheet with just District names. Using the lookup feature in Excel I can make the sheet without the codes (Which are not written exactly like those in the sheet WITH the codes) match up and give me the codes on the other sheet.

However, I tried doing this iN SQL with the "like" command (Thinking that if Albany School D is LIKE Albany School District, it would work) and it doesn't do.

Any suggestions?
J
 
How did you word the SQL statement?? did u use

like "*" & [txtboxname] & "*"

I am just guessing here, but assume you have somewhere u are typing in the ALbany school d. That is the [txtboxname].

Hope this helps
raven
 
This is what I have:

SELECT [TBL School District and District Codes].[District Code], [Tbl 1995 NYS All Districts].[School Districts], [Tbl 1995 NYS All Districts].[SAT I V], [Tbl 1995 NYS All Districts].[SAT I M]
FROM [TBL School District and District Codes], [Tbl 1995 NYS All Districts]
WHERE [Tbl 1995 NYS All Districts].[School Districts] Like "*" & [TBL School District and District Codes].[District Code] & "*"

Could it be that the Two School District Names are just so disimiliar that this won't work?
J
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top