logo       

Re: Query clause from previous query: msg#00044

cms.cold-fusion.user.azcfug

Subject: Re: Query clause from previous query

Try this function PreserveSingleQuotes() to see if that works for you.

<CFQUERY DATASOURCE="#dsn#" NAME="qry1Alt">
SELECT * FROM table1
WHERE #PreserveSingleQuotes(qry2.clause)#
</CFQUERY>

Terence Chang

----- Original Message -----
From: Gregg Bookspan <gmb@xxxxxxxxxxxxx>
To: <azcfug-VgYJa0VH1e9BDgjK7y7TUQ@xxxxxxxxxxxxxxxx>
Sent: Wednesday, July 12, 2000 9:57 PM
Subject: [azcfug] Query clause from previous query


> Hello -
>
> I got a question for the group collective.
>
> I have a query:
>
> <CFQUERY DATASOURCE="#dsn#" NAME="qry1">
> SELECT * FROM table1
> WHERE field1='abc' OR field1='xyz'
> </CFQUERY>
>
> This query will pull all data if field1 is either abc or xyz, right?
Right,
> it works fine. This is where things get interesting... I've got another
> table:
>
> <CFQUERY DATASOURCE="#dsn#" NAME="qry2">
> SELECT clause FROM table2
> WHERE ID=1
> </CFQUERY>
>
> Let's say the entry for ID 1 in table2 looks like this:
>
> ID clause
> -- ----------------------------
> 1 field1='abc' OR field1='xyz'
>
> If I create another query:
>
> <CFQUERY DATASOURCE="#dsn#" NAME="qry1Alt">
> SELECT * FROM table1
> WHERE #qry2.clause#
> </CFQUERY>
>
> It throws an error (and this DB is Access for testing):
>
> Syntax error (missing operator) in query expression 'table1.field1=''abc''
> OR table1.field1=''xyz''
>
> It is putting an extra set of single quotes around the operands...
> Obviously, if I leave off the single quotes in the clause field of table2
I
> get a data type mismatch. Is there a way to make this work? If this is
> confusing, buy you still want to help, I am happy to provide actaul
queries
> with actual table and field names...
>
> Thanks!
> Gregg Bookspan
> Director of Internet Technologies
> Marks-Ferber Communications, LLC
> Tel602-200-6811 Fax602-200-6802
>
> PS - Looking for a full-time ColdFusion and/or ASP developer
>
>
> ------------------------------------------------------------------------
> LOW RATE, NO WAIT!
> Get a NextCard Visa, in 30 seconds! Get rates
> as low as 2.9% Intro or 9.9% Fixed APR and no hidden fees.
> http://click.egroups.com/1/6629/13/_/_/_/963463883/
> ------------------------------------------------------------------------
>
> To unsubscribe from this group, send an email to:
> azcfug-unsubscribe-VgYJa0VH1e9BDgjK7y7TUQ@xxxxxxxxxxxxxxxx
>
>


__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com





<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise