Link to home
Start Free TrialLog in
Avatar of Sean Rhudy
Sean RhudyFlag for United States of America

asked on

Access Sql Query help

Hello,

I have a query and a table that I need to join.  The table is called Associates and has asKey asFirstName, and asLastName.  The query is called JoinAssoc and has Associd which needs to be joined with Associates.asKey. I also need this new query to have SlDate and SalesCount from Query JoinAssoc.  It would also be great if I could join the asFirstName and asLastName into one column.
Avatar of Pratima
Pratima
Flag of India image

Select Associates.*, JoinAssoc.SalesCount , JoinAssoc.SlDate  from Associates
Inner Join JoinAssoc  ON JoinAssoc.Associd  = Associates.asKey
Avatar of Sean Rhudy

ASKER

Getting type mismatch error.
For Concatination of first name and last name

Select Associates.asKey ,Associates.asFirstName & " " & Associates.asLastName, JoinAssoc.SalesCount , JoinAssoc.SlDate  from Associates
Inner Join JoinAssoc  ON JoinAssoc.Associd  = Associates.asKey

Select Associates.asKey ,Associates.asFirstName & " " & Associates.asLastName as Name, JoinAssoc.SalesCount , JoinAssoc.SlDate  from Associates
Inner Join JoinAssoc  ON JoinAssoc.Associd  = Associates.asKey
JoinAssoc.Associd   and Associates.asKey must have of same type
is it ?
How can i check? there both just an ID number ranging from 1 to 999 that identifies a Sales Associate.
check in table Design
Select table -> Right Click  -> Design View
and check what datatype used for both fields ?
asKey is Text, Associd is a number, can I convert asKey to a number through the query?
Just change it in esign view itself
I can't, the database that these tables are in are being used by a Point of Sale software, and changing the data type will cause issues.  
Then try this

Select Associates.asKey ,Associates.asFirstName & " " & Associates.asLastName as Name, JoinAssoc.SalesCount , JoinAssoc.SlDate  from Associates
Inner Join JoinAssoc  ON JoinAssoc.Associd  = Cast ( Associates.asKey as int)
ASKER CERTIFIED SOLUTION
Avatar of Pratima
Pratima
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That worked, thanks.