We help IT Professionals succeed at work.
Get Started

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

intellisource
on
301 Views
Last Modified: 2012-05-11
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...
Comment
Watch Question
Top Expert 2010
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE