Close.. Try this:

Select Col1 + Col2 as 'ColCombined' 
from MyTable 
WHERE Col1 LIKE '%foo%'
ORDER BY ColCombined

-----Original Message-----
From: Robert Rawlins [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 05, 2007 4:47 AM
To: CF-Talk
Subject: M$SQL: Treat two columns as one

Hello Guys,

I'm looking to pull a set of records from the database but treat two of the
columns as one, I'll also need to GROUP BY on that combined column, so
somthing like this.

SELECT Col1 & Col2 AS ColCombined
FROM MyTable
WHERE Col1 LIKE '%foo%'
GROUP BY ColCombined

Does that make sense? Basicly this is a single string that is split when its
entered into the database and needs to be combined on its way out. They are
also pulled from the database as seperate entities on a regular basis in a
different query, thats why they're split on the way in.

If this isnt possible then i'll just build in another 'combined' column into
the database, but i'd rather avoid that duplication.

Thanks guys,

Rob



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create Web Applications With ColdFusion MX7 & Flex 2. 
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:271501
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to