<cfquery name="foo" datasource="bar">
SELECT
filename,
right(filename, 3) AS ext,
othercol
FROM
table
ORDER BY
right(filename, 3)
</cfquery>
<cfoutput query="foo" group="ext">
that, of course, assumes you only have file extensions of 3
characters. .jpeg or .tiff would throw off the logic. I suppose you
could run an instr() function inside of a CASE to determine the
position of the dot if need be.
On 7/23/07, Robert Rawlins - Think Blue
<[EMAIL PROTECTED]> wrote:
> Hello Guys,
>
>
>
> I've got a query which returns a load of file names which I'm looking to
> group by their extension. Is there any way to do this dynamically from the
> name or do I have to make a separate column in the database?
>
>
>
> Can I do something like this:
>
>
>
> <cfoutput query="myquery" group="right(filename, 3)">
>
> #myquery.filename#
>
> </cfoutput>
>
>
>
> Thanks guys for any help, first time I've done any cf in a while, things are
> feeling a little rusty.
>
>
>
> Rob
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get involved in the latest ColdFusion discussions, product
development sharing, and articles on the Adobe Labs wiki.
http://labs/adobe.com/wiki/index.php/ColdFusion_8
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284359
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4