great for DBs which support t-sql stored procedures :-)
-Original Message-
From: Bill Grover [mailto:[EMAIL PROTECTED]
Sent: 06 August 2003 14:05
To: CF-Talk
Subject: RE: SQL: Brain Teaser
If you wanted to do it all in SQL you can try the following. I would write
it as a stored
esday, August 06, 2003 7:46 AM
To: CF-Talk
Subject: RE: SQL: Brain Teaser
> > USERS TABLE
> > -
> > USER_ID
> > USERNAME
> > etc...
> >
> > COMMENTS TABLE
> > -
> > COMMENT_ID
> > USER_ID
> > CO
Tyler Clendenin wrote:
> Well of course one can write a sp to do it but it would be so nice to just
> have it in a single query.
You can. You just have to declare the aggregate first (in most
databases, MySQL even has it predefined).
Jochem
~~~
; cfoutput to group I wish they would add group to cfloop at least then it
> would be a little easier.
>
> Tyler Clendenin
> GSL Solutions
>
> -Original Message-
> From: Tony Schreiber [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 06, 2003 7:46 AM
> To: CF-Tal
> > USERS TABLE
> > -
> > USER_ID
> > USERNAME
> > etc...
> >
> > COMMENTS TABLE
> > -
> > COMMENT_ID
> > USER_ID
> > COMMENT
> > etc...
> >
> > I know I can query USERS and then loop through the results fetching
> > the comments... but I'd rather not do that
thats what its doing.SP;s are far more efficient anyway
-Original Message-
From: Tyler Clendenin [mailto:[EMAIL PROTECTED]
Sent: 06 August 2003 14:21
To: CF-Talk
Subject: RE: SQL: Brain Teaser
Well of course one can write a sp to do it but it would be so nice to just
have it in
ent: Wednesday, August 06, 2003 9:49 AM
> To: CF-Talk
> Subject: RE: SQL: Brain Teaser
>
>
> Ah. But by "loop through results and fetch comments" I
> thought you meant
> something like query then loop and do a query for each user...
>
> What I wrote would be perfe
Tyler Clendenin wrote:
> Ahh if only there was a way to do that I would be so happy.
Why wouldn't there be a way to do that? What DBMS are you using?
Jochem
~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid
20850-1299WWW:http://www.euservices.com
__
> -Original Message-
> From: Robertson-Ravo, Neil (RX)
> [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 06, 2003 9:08 AM
> To: CF-Talk
> Subject: RE:
SELECT U.UserID,Username,CommentID,Comment
FROM Users U LEFT OUTER JOIN Comments C ON U.UserID = C.UserID
Order By U.UserID, CommentID
#UserID#,#UserName##Comment#
>Perhaps this is easy for someone so I figured I'd ask. Here's the scenario:
>
>USERS TABLE
>-
>USER_ID
>USERN
Well of course one can write a sp to do it but it would be so nice to just
have it in a single query.
Tyler Clendenin
GSL Solutions
-Original Message-
From: Jochem van Dieten [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 06, 2003 7:59 AM
To: CF-Talk
Subject: Re: SQL: Brain Teaser
Ahh if only there was a way to do that I would be so happy.
Tyler Clendenin
GSL Solutions
-Original Message-
From: Jochem van Dieten [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 06, 2003 6:35 AM
To: CF-Talk
Subject: Re: SQL: Brain Teaser
[EMAIL PROTECTED] wrote:
>
> USERS
ville, MD 20850-1299WWW:http://www.euservices.com
__
> -Original Message-
> From: Tyler Clendenin [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 06, 2003 8:58 AM
> To: CF-Talk
> Subject: RE: SQL: Brain Teas
temp table and then select all from that table then drop?
-Original Message-
From: Tyler Clendenin [mailto:[EMAIL PROTECTED]
Sent: 06 August 2003 13:58
To: CF-Talk
Subject: RE: SQL: Brain Teaser
That would do it but not from sql. I know really don't like having to use
cfoutput to
Ahh if only there was a way to do that I would be so happy.
Tyler Clendenin
GSL Solutions
-Original Message-
From: Jochem van Dieten [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 06, 2003 6:35 AM
To: CF-Talk
Subject: Re: SQL: Brain Teaser
[EMAIL PROTECTED] wrote:
>
> USERS
esday, August 06, 2003 7:46 AM
To: CF-Talk
Subject: RE: SQL: Brain Teaser
> > USERS TABLE
> > -
> > USER_ID
> > USERNAME
> > etc...
> >
> > COMMENTS TABLE
> > -
> > COMMENT_ID
> > USER_ID
> > CO
___
>
>
>
> > -Original Message-
> > From: Tony Schreiber [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, August 06, 2003 9:49 AM
> > To: CF-Talk
> > Subject: RE: SQL: Brain Teaser
> >
> >
> > Ah. But by "loop through results
Well of course one can write a sp to do it but it would be so nice to just
have it in a single query.
Tyler Clendenin
GSL Solutions
-Original Message-
From: Jochem van Dieten [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 06, 2003 7:59 AM
To: CF-Talk
Subject: Re: SQL: Brain Teaser
[EMAIL PROTECTED] wrote:
>
> USERS TABLE
> -
> USER_ID
> USERNAME
> etc...
>
> COMMENTS TABLE
> -
> COMMENT_ID
> USER_ID
> COMMENT
> etc...
>
> I know I can query USERS and then loop through the results fetching the
> comments... but I'd rather not do that
19 matches
Mail list logo