You know... I love this idea - very cool.... I had not thought of that.

-Mark

Mark A. Kruger, MCSE, CFG
www.cfwebtools.com
www.necfug.com
http://blog.mxconsulting.com
...what the web can be!

  -----Original Message-----
  From: Nick de Voil [mailto:[EMAIL PROTECTED]
  Sent: Monday, March 29, 2004 8:25 AM
  To: CF-Talk
  Subject: Re: SQL grouped query help

  > > > Now, I want to select only the latest article from each issue in a
  > > > single query. Any ideas how I would do this?

  Kind of sneaky, but something like this will do it (substitute the relevant
  type conversion & string concatenation functions for your DBMS)

  SELECT     articleIssueId, articleTitle, articleDate
  FROM        myArticles
  WHERE    convert(char(16), articleIssueID) + '_' + convert(char(16),
  articleID)
  IN
      (SELECT convert(char(16), articleIssueID)  + '_' + convert(char(16),
  MAX(articleid))
      FROM myArticles GROUP BY articleIssueID)

  Nick
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to