House of Fusion
Home of the ColdFusion Community

Search cf-talk

December 02, 2008

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
   1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31       

Search over 2,500 ColdFusion resources here  >>>      
Home /  Groups /  ColdFusion Talk (CF-Talk)

SQL concat? help

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 

08/04/2006 04:00 PM
Author:
Kris Jones

The syntax you're using is, I think, correlated subquery. Not sure what that concat() function does--maybe that was a UDF that returned an actual list of IDs? In any case, here is a simple join that would return a recordset of related IDs: select s.someid, so.someotherid from mytable s left outer join anothertable so on s.someid=so.somid Cheers, Kris On 8/4/06, Russ <cflists@ruslansivak.com> wrote:

08/04/2006 04:58 PM
Author:
Russ

What I actually wanted was a list of all someotherID's for a someID in a single column.  I found a function that sort of does this (Coalesce), and after digging up my old code, did it using temp tables and cursors.   I was optimizing code that was doing it in CF and was taking a little too long to run for my taste.   Russ

08/04/2006 05:09 PM
Author:
Kris Jones

In CF, getting a list of values from a column in a query is pretty trivial: valuelist(qryname.colname) Cheers, Kris > What I actually wanted was a list of all someotherID's for a someID in a > single column.  I found a function that sort of does this (Coalesce), and > after digging up my old code, did it using temp tables and cursors. > > I was optimizing code that was doing it in CF and was taking a little too > long to run for my taste.

08/04/2006 05:22 PM
Author:
Russ

Yes, but if you have to run a separate query for each row of the parent query, that will kill performance.  

08/05/2006 11:24 AM
Author:
Jochem van Dieten

Russ wrote: > What I actually wanted was a list of all someotherID's for a someID in a > single column.  I found a function that sort of does this (Coalesce), and > after digging up my old code, did it using temp tables and cursors.   > > I was optimizing code that was doing it in CF and was taking a little too > long to run for my taste.   If your database is extensible you can write your own aggregate function for that. For instance, in PostgreSQL that would be something like: CREATE AGGREGATE gr_aggr (   sfunc = array_append,   basetype = anyelement,   stype = anyarray,   initcond = '{}' ); SELECT id, gr_aggr(val) FROM table GROUP BY id; Jochem


<< Previous Thread Today's Threads Next Thread >>

Mailing Lists