Author |
Topic |
|
Cliff
Average Member
United States
501 Posts |
Posted - 19 November 2003 : 22:38:29
|
I am trying to write a query for Access. Here is what I have so far
SELECT Employees.Emp_ID, Employees.Last_Name, Employees.First_Name, Employees.Active_Inactive, Employees.Email, BBTS.Numb, BBTS.Standard, BBTS.BWHLab FROM Employees INNER JOIN BBTS ON Employees.Emp_ID Like 'BBTS.BWHLab%' WHERE Employees.Active_Inactive = 'A'
Here is where the problem is. I hoped I could use "Like" in the join statement, but I get an error saying it's not supported. The info I have is from two table, one has data, the other has employee info. The data table "BBTS" has a field that has three parts to it, the Emp_id first name and last name (don't ask why I did it this way). The Emp_ID field is just that, the Emp_ID only.
So what I need to accomplish is match the records where the Emp_ID field is also the beginning of the BWHLab field.
i.e.
123456 = 123456 Robert Smith
I have this working on another page using it as a where statement, but I don't think that will work in this case.
Any suggestions are appreciated. |
|
Nikkol
Forum Moderator
USA
6907 Posts |
Posted - 19 November 2003 : 23:10:25
|
why won't it work in this case if it worked on another page? I would also suggest that you just restructure your table to that you have a field in the BBTS table that matches just the employee ID. It would make your queries a lot less complicated. |
Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~ |
|
|
Cliff
Average Member
United States
501 Posts |
Posted - 19 November 2003 : 23:18:41
|
Nikkol, The like part worked in a where clause on the other page, now I am trying to put it in the join clause, it doesn't seem to like that.
I knew I was shooting myself when I set it up this way, I suspect I will need to simply cut and paste the first part of the field into a new field.
Structure is everything.
Thanks. |
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
|
|
Topic |
|