Avatar of intellisource
intellisource
Flag for South Africa

asked on 

why does this straightforward left join query, return null values for strings and dates?

hi everybody,

i am currently having issues with the following left join select. the dateadd and the current timestamp are included in the selection to filter out the results but obviously it would not work as the logic dictates because the tables return null for all joins! attached you would find an xsl workbook with a page for the Faulty Query, as well as the individual tables selecting from.

SELECT 
	CURRENT_TIMESTAMP AS CURDATE, 
	ADDDATE(
		CS.timestamp_SurveyDateCreated, 
		INTERVAL ST.tinyint_ResendInterval DAY
	) AS OFFDATE, 
	C.*, 
	SL.*, 
	SP.* 
FROM 
	21_consumersurveys CS 
LEFT JOIN (
	19_consumers C, 
	25_serviceleads SL, 
	10_serviceprospects SP, 
	20_surveytypes ST 
) ON (
	CS.bigint_ConsumerID = C.bigint_ConsumerID AND 
	CS.bigint_LeadID = SL.bigint_LeadID AND 
	CS.bigint_ReferenceID = SP.bigint_ProspectID AND 
	CS.bigint_SurveyType = ST.bigint_SurveyID
)

Open in new window


the where part of the statement is supposed to look as follows:

WHERE 
	OFFDATE <= CURDATE AND 
	CS.tinyint_SurveyStatus = 0;

Open in new window


please tell me if you can see the issue, i do not seem to find a resolution here...
MySQL Server

Avatar of undefined
Last Comment
qasim_md

8/22/2022 - Mon