Ask a Question related to Coldfusion Database Access, Design and Development.
-
RuBot #1
Help! What's wrong with my QUERY statement??
Also, checking the table, duedate is held as 8/12/2005 whereas if I
#dateformat(duedate,"mm/dd/yyyy")# it will come out with a leading 0. Is that
throwing me off?
Here's my statement
<cfquery datasource="HelpDesk" name = "reminder">
select a.entry_date, a.entry_description, a.emailto, a.remind, b.email
from Help_Desk_List a, TechsTbl b
where ((a.duedate = '#dateformat(now,"mm/dd/yyyy")#') and (a.status =
'Open') and (a.name = b.name) and (a.remind = 'Yes'))
</cfquery>
RuBot Guest
-
#38787 [NEW]: Wrong line number in switch statement
From: rick at dualmedia dot it Operating system: Linux ubuntu PHP version: 4.4.4 PHP Bug Type: Scripting Engine problem Bug... -
What is wrong with this insert statement?
Here is the code: (I'll put the error below) <cfquery datasource="hubclub"> INSERT INTO Customers, Orders ( Customers.FirstName,... -
mssql: update statement wrong or truncated
Hi ! I have this upate statement which gets sent to MS SQL: update MsgOutgoing set SenderResource = NULL,RecipientAddress =... -
What am I doing wrong; problem with INSERT statement (ASP/MS ACCESS)
Does column desc allow empty strings? "Simom Thorpe" <simonocthorpe@hotmail.com> wrote in message... -
field seperator in select / wrong statement ?
Hi, is there a way to set a field-seperator for the output? I have to get a row of fields which also can contain spaces. So the blank for the... -
RuBot #2
Re: Help! What's wrong with my QUERY statement??
<cfset datenow = "#dateformat(now(),"mm-dd-yyyy")#">
<cfquery datasource="HelpDesk" name = "reminder">
select a.entry_date, a.entry_description, a.emailto, a.remind, b.email
from Help_Desk_List a, TechsTbl b
where ((a.duedate = #datenow#)
and (a.status = 'Open') and
(a.name = b.name) and
(a.remind = 'Yes'))
</cfquery>
this also produces no error, but no results as well.
RuBot Guest
-
rmorgan #3
Re: Help! What's wrong with my QUERY statement??
I am going to guess its your 'and' statements, you are requireing that all of those exist when they may not therefore, no results. Try changing the 'and' to 'or' and see what you get then.
rmorgan Guest
-
CF_Oracle #4
Re: Help! What's wrong with my QUERY statement??
What database do you have?
Maybe it's case sencitive then values must be 'OPEN' and "YES". Also most likely #datenow# must be in single quotes:
'#datenow#'.
CF_Oracle Guest
-
san_diego_ca #5
Re: Help! What's wrong with my QUERY statement??
Try it without the DateFormat function. The function returns a string and the datatype in the database is most likely a date.
san_diego_ca Guest
-
mxstu #6
Re: Help! What's wrong with my QUERY statement??
RuBot,
I don't think Access will interpret the date correctly if you pass it that
way. Try using the CreateODBCDate() method intstead. It ensures that the date
is passed to the database in a format it can interpret correctly. Assuming the
table contains the data that match the WHERE clause conditions, the query below
will return results.
Also, if the "name" field is a "text" field (ex. 'JohnSmith'), you should
think about redesigning the tables. It is a bad idea to use a "text" field as
a foreign key. The reason being that if the "name" field changes in one table,
the other table is not automatically updated. If this happens your data will be
inconsistent and your queries may return incorrect results. A better structure
would be to create a numeric ID in the "TechsTbl" table and reference that
numeric ID in the "Help_Desk_List" table instead of the text "name".
<cfquery datasource="HelpDesk" name = "reminder">
SELECT a.entry_date, a.entry_description, a.emailto, a.remind, b.email
FROM Help_Desk_List a, TechsTbl b
WHERE a.duedate = #CreateODBCDate(now())#
AND a.status = 'Open'
AND a.remind = 'Yes'
AND a.name = b.name
</cfquery>
mxstu Guest



Reply With Quote

