|
RE: Query clause from previous query: msg#00045cms.cold-fusion.user.azcfug
PreserveSingleQuotes() worked like a champ! 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 >-----Original Message----- >From: Terence Chang [mailto:peanutlen@xxxxxxxxxxxxx] >Sent: Wednesday, July 12, 2000 11:08 PM >To: azcfug-VgYJa0VH1e9BDgjK7y7TUQ@xxxxxxxxxxxxxxxx >Subject: Re: [azcfug] 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 |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Query clause from previous query: 00045, Terence Chang |
|---|---|
| Next by Date: | Re: FW: thanks: 00045, dwiese |
| Previous by Thread: | Re: Query clause from previous queryi: 00045, Terence Chang |
| Next by Thread: | what's wrong with cfcache?: 00045, Terence Chang and Yin Li |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |