If the db is MS-SQL or Sybase, you could possibly do this with T/SQL
But, sooner or later the db needs to be normalized:
a separate table for comments -- something like this
*
*
*
CommentID Integer Primary Key,
MainTableID Integer References MainTable(MainTableID)
CommentDateTime DateTime,
Comment Text (or varchar)
*
*
*
With this structure, you let SQL do its thing -- and doing what you are
trying to do is fast, simple and efficient!
The sooner you do this the better -- before you propagate convoluted
work-arounds to (bad, bad) db design throughout your applications
HTH
Dick
On Mar 31, 2004, at 10:02 AM, Deanna Schneider wrote:
> So, you're saying all the comments are just in one big text field? And
> that
> you want to get the first comment in that big text field? Is that
> accurate?
> (It's horrible DB design, btw.)
>
> If so, you should be able to do this:
> <cfsavecontent variable="comments">
> *** 13/01/2003 09:47:06 TUser1 ***
> callno:1126
> Some comment1
>
> *** 13/01/2003 08:30:27 TUser2 ***
> Some Comment2
> </cfsavecontent>
>
> <cfoutput>
> FIRST COMMENT =<br>
> *** #listgetat(comments, 2, "***")# ***<br>
> #listgetat(comments, 3, "***")#
> </cfoutput>
>
> Ugly ugly, though.
>
> ----- Original Message -----
> From: "cf coder"
>
> > Hi Guys,
> >
> > I'm strugging to display the data correctly from the
> > comment column in the database and need your help. I
> > want to display the top most comment from the comments
> > table. Here is an example. In the example below there
> > are 2 comments
> >
> > *** 13/01/2003 09:47:06 TUser1 ***
> > callno:1126
> > Some comment1
> >
> > *** 13/01/2003 08:30:27 TUser2 ***
> > Some Comment2
> >
> > I want to display the TOP most comment. In this case
> >
> > *** 13/01/2003 09:47:06 TUser1 ***
> > callno:1126
> > Some comment1
> >
> > All comments have the ***, date time and user
> > information
> > "*** 13/01/2003 09:47:06 TUser1 ***"
> >
> > I would really apprecaite your help.
> > Best Regards,
> > cfcoder
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Finance Tax Center - File online. File on time.
> > http://taxes.yahoo.com/filing.html
> >
> >
>
[Todays Threads]
[This Message]
[Subscription]
[Fast Unsubscribe]
[User Settings]
- string formatting and manipulation cf coder
- Re: string formatting and manipulation Dick Applebaum
- Re: string formatting and manipulation Deanna Schneider
- FLEX: are you HERE or are you NOW? Dick Applebaum
- FLEX: are you HERE or are you NOW? Peter Tilbrook
- Re: FLEX: are you HERE or are you NOW? Christian Cantrell
- Re: FLEX: are you HERE or are you... Scott Weikert
- Re: FLEX: are you HERE or are... Christian Cantrell
- Re: FLEX: are you HERE or... Dick Applebaum
- Re: FLEX: are you HERE or... Dick Applebaum
- Re: FLEX: are you HERE or are you... Jochem van Dieten
- Re: FLEX: are you HERE or are you... Howard Fore
- Re: FLEX: are you HERE or are you NOW? Thomas Chiverton
- Re: string formatting and manipulation cf coder