Is there a way to join 2 tables where the 2 fields on which the tables joined are of different data types(char and varchar)?I tried with CONVERT but is does not give the desired output.
My requirement is to get the minimum (earliest) Posted date along with two other fields.But when i join the two fields I get the duplicate records as well.
Following is my query.
---------------------------------------------------------------------------------------------------------
SELECT DISTINCT RMS_T_CV_SENT_I NFORMATION.ReqR efID,
T.FirstName,MIN (RMS_T_CV_SENT_ INFORMATION.CVP ostedDate) AS Posteddate FROM
RMS_T_CV_SENT_I NFORMATION JOIN
(SELECT DISTINCT RMS_T_CV_INFORM ATION.FirstName ,RMS_T_CV_INFOR MATION.CVRefID
FROM RMS_T_CV_INFORM ATION GROUP BY RMS_T_CV_INFORM ATION.FirstName ,RMS_T_CV_INFOR MATION.CVRefID) AS T
ON CONVERT(varchar (11),SUBSTRING( T.CVRefID,1,11) )=CONVERT(varch ar(11),SUBSTRIN G(RMS_T_CV_SENT _INFORMATION.CV ID,1,11))
GROUP BY RMS_T_CV_SENT_I NFORMATION.ReqR efID,T.FirstNam e
ORDER BY RMS_T_CV_SENT_I NFORMATION.ReqR efID
---------------------------------------------------------------------------------------------------------
In the above ,the RMS_T_CV_SENT_I NFORMATION.CVID and RMS_T_CV_INFORM ATION.CVRefID are the related fields but one is of varchar(15) and other field is of Char(15).
I m sorry ,if this is too lenthy and confusing.
thanks in advance.
My requirement is to get the minimum (earliest) Posted date along with two other fields.But when i join the two fields I get the duplicate records as well.
Following is my query.
---------------------------------------------------------------------------------------------------------
SELECT DISTINCT RMS_T_CV_SENT_I NFORMATION.ReqR efID,
T.FirstName,MIN (RMS_T_CV_SENT_ INFORMATION.CVP ostedDate) AS Posteddate FROM
RMS_T_CV_SENT_I NFORMATION JOIN
(SELECT DISTINCT RMS_T_CV_INFORM ATION.FirstName ,RMS_T_CV_INFOR MATION.CVRefID
FROM RMS_T_CV_INFORM ATION GROUP BY RMS_T_CV_INFORM ATION.FirstName ,RMS_T_CV_INFOR MATION.CVRefID) AS T
ON CONVERT(varchar (11),SUBSTRING( T.CVRefID,1,11) )=CONVERT(varch ar(11),SUBSTRIN G(RMS_T_CV_SENT _INFORMATION.CV ID,1,11))
GROUP BY RMS_T_CV_SENT_I NFORMATION.ReqR efID,T.FirstNam e
ORDER BY RMS_T_CV_SENT_I NFORMATION.ReqR efID
---------------------------------------------------------------------------------------------------------
In the above ,the RMS_T_CV_SENT_I NFORMATION.CVID and RMS_T_CV_INFORM ATION.CVRefID are the related fields but one is of varchar(15) and other field is of Char(15).
I m sorry ,if this is too lenthy and confusing.
thanks in advance.
Comment