I have a customer visit search feature that I am trying to add to our CRM. I need to join the persons name from another table "CustData" into "CustVisits", but the only thing I have to make a relation with is the CustID. I get:
"error converting datatype varchar to bigint" Here's the SQL that works minus what I need:
SELECT vcCustID AS [Cust ID], vcName AS [Community Name], dtVisitDate AS [Visit
Date], dtVisitTime AS [Visit Time] FROM (SELECT TOP 1 * FROM custvisits WHERE vcname
= '" & strVcname & "' AND dtvisitdate = '" & strdate &"' ORDER BY nEntry DESC) DERIVEDTBL
This is the final piece of the puzzle and any help would be appreciated. I have thought about adding the Customer name to the CustVisits table, that may
be the solution (I didn't build it, just inherited a big pile of junk to fix); unless someone here can help me over come the datatype problem. Thanks.
If I understand the question, you have to make sure custID on both tables are INT columns.
SELECT cv.vcCustID, cv.vcName, cv.dtVisitDate,cv.VisitTime,cd.custID
FROM custvisits cv,custdata cd
WHERE cv.custID = cd.custID
AND cv.vcname = @strvcname
AND cv.dtvisitdate = @strdate
ORDER BY cv.nEntry DESC
PD_Goss
Contributor
2310 Points
460 Posts
SQL Help
Aug 01, 2003 04:07 AM|LINK
mxmissile
Participant
1617 Points
372 Posts
Re: SQL Help
Aug 01, 2003 07:22 PM|LINK