Using this query:
if not exists (select photo_filename
from hmls_photos
where photo_filename = <cfqueryparam cfsqltype="cf_sql_varchar"
value="#photolist.name#">)
insert into hmls_photos
(photo_filename, photo_mls_number)
values (<cfqueryparam cfsqltype="cf_sql_varchar"
value="#photolist.name#">,
<cfqueryparam cfsqltype="cf_sql_varchar"
value="#listfirst(photolist.name, '_')#">)
I get this error concerning this syntax... don't know about the "if" part...
Error Executing Database Query.
You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version
for the right syntax to use near
'if not exists (select photo_filename from hmls_photos where pho'
at line 1
> -----Original Message-----
> From: Richard Dillman [mailto:[EMAIL PROTECTED]
> Sent: Friday, May 16, 2008 12:05 PM
> To: CF-Talk
> Subject: Re: What's wrong with this query?
>
> Wouldnt you put an IF at the begining of the statement?
>
> <cfquery name="insert_photo" datasource="c21ar">
> IF NOT EXISTS (SELECT PHOTO_FILENAME
> FROM HMLS_PHOTOS
> WHERE PHOTO_FILENAME = <cfqueryparam
> cfsqltype="cf_sql_varchar" value="#photolist.name#">)
> INSERT INTO HMLS_PHOTOS
> (PHOTO_FILENAME,
> PHOTO_MLS_NUMBER)
> VALUES (<cfqueryparam cfsqltype="cf_sql_varchar" value="#
> photolist.name#">,
> <cfqueryparam cfsqltype="cf_sql_varchar" value="#listfirst(
> photolist.name,'_')#">)
> </cfquery>
>
>
> --
> --
> Richard Dillman
> [EMAIL PROTECTED]
>
> "There are painters who transform the sun to a yellow spot, but there are
> others who with the help of their art and their intelligence, transform a
> yellow spot into the sun."
> - Pablo Picasso
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:305474
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4