April 10, 2007 at 12:30 am
SELECT tblContact.ContactID, tblContact.Title + tblContact.FName + tblContact.MName + tblContact.LName AS Name,
tblDesignation.DesignationName, tblContact.DesignationID, tblCompany.CompanyName
FROM tblContact, tblDesignation, tblOperator, tblCompany, tblCountry Where tblDesignation.DesignationID = 3 AND tblCountry.CountryID = 3 AND tblOperator.OperatorID= 6 AND (tblContact.FName like '%san%' OR tblContact.MName like '%san%' OR tblContact.LName like '%san%' OR tblCompany.CompanyName like '%san%') AND [DateEntered] BETWEEN (( YEAR([DateEntered]) = 2006 AND MONTH([DateEntered]) =12 AND DAY([DateEntered]) = 12)
AND ( YEAR([DateEntered]) = 2007 AND MONTH([DateEntered]) = 12 AND DAY([DateEntered]) = 12)) AND (1=1)
AND tblContact.DesignationID = tblDesignation.DesignationID
AND tblContact.OperatorID = tblOperator.OperatorID
AND tblContact.CompanyID = tblCompany.CompanyID
What is the error in this Query? plz
it's Urgent.....
April 10, 2007 at 1:20 am
Hi,
[DateEntered] BETWEEN (( YEAR([DateEntered]) = 2006 AND MONTH([DateEntered]) =12 AND DAY([DateEntered]) = 12)
AND ( YEAR([DateEntered]) = 2007 AND MONTH([DateEntered]) = 12 AND DAY([DateEntered]) = 12))
should say
[DateEntered] BETWEEN '20061212' AND '20071212'
K. Matsumura
April 10, 2007 at 1:40 am
...and I guess the words "formatted code" just aren't in your dictionary, huh?
--Jeff Moden
Change is inevitable... Change for the better is not.
April 10, 2007 at 3:28 am
AND [dateentered] BETWEEN ((YEAR([dateentered]) = 2006
AND MONTH([dateentered]) = 12
AND DAY([dateentered]) = 12)
AND (YEAR([dateentered]) = 2007
AND MONTH([dateentered]) = 12
AND DAY([dateentered]) = 12))
AND (1 = 1)
I think the between clause is wrong
coze
test_expression [ NOT ] BETWEEN begin_expression AND end_expression
regards shashi kant
April 10, 2007 at 1:07 pm
I don't know....what is the error? If it didn't work you should have gotten an error message - what was it? If it didn't return what you expected - provide us the schema, sample data, what was returned, and what you expected to get returned.
-SQLBill
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply