If you can't use Aaron's suggestion because you can't modify the query for some reason and only have access to the returned query object, I see two options:
1) You can use QueryAddColumn to add the new column to the query. http://cfquickdocs.com/cf8/#QueryAddColumn >From the description of QueryAddColumn, it takes a one dimensional array to populate the new column, so you can create a new array and loop from 1 to query.recordcount to populate it with "Mr."... 2) use query of queries to join your query with the static column something like this pulled out of the air, non-tested code: <cfquery name="newQuery" dbtype="query"> select 'Mr.' as Salutation, firstName, lastName from origQuery </cfquery> --Ken On Wed, Nov 10, 2010 at 11:13 AM, Aaron Rouse <[email protected]> wrote: > Perhaps I am just oversimplifying things but why could you not just add it > to the query itself? Something like: > > SELECT 'Mr.' SALUTATION, FIRSTNAME, LASTNAME FROM MYTABLE > > > On Wed, Nov 10, 2010 at 11:10 AM, Mark Davis <[email protected]> wrote: > >> hey gang, >> >> I am trying to figure out the best way to accomplish this. >> >> I have a query object with a couple of columns, say firstName, lastName. >> >> I need to add a new column to the query and set the value for every row in >> that query to the same value. So the column could be Salutation and every >> value needs to be "Mr." Any thoughts? >> >> Thanks >> >> Mark >> >> -- >> You received this message because you are subscribed to the "Houston >> ColdFusion Users' Group" discussion list. >> To unsubscribe, send email to [email protected] >> For more options, visit http://groups.google.com/group/houcfug?hl=en > > > > > -- > Aaron Rouse > http://www.happyhacker.com/ > > -- > You received this message because you are subscribed to the "Houston > ColdFusion Users' Group" discussion list. > To unsubscribe, send email to [email protected] > For more options, visit http://groups.google.com/group/houcfug?hl=en > -- You received this message because you are subscribed to the "Houston ColdFusion Users' Group" discussion list. To unsubscribe, send email to [email protected] For more options, visit http://groups.google.com/group/houcfug?hl=en
