🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #11231

JOIN and max query

#11231
From: DP
Date: Thu, 12 Dec 2002 11:21
29 lines
1667 bytes
Hello

I asked something similar to this in the past, but even with the previous
answer, this slight variation has me stumped (not hard to do)

TableA
A_ID  integer
Text varchar(100);

TableB
B_ID      integer
A_ID      integer
Price       integer
Changed TIMESTAMP

For every A_ID, I'd like the latest price (deduced by 'Changed') from
Table_B.  There could be multiple(or zero) entries for A_ID in TableB.

I need the following columns:  A.A_ID,  A.Text,  B.Price, B.Changed

where  B.Price, B.Changed are the most recent entry in Table B.

I can guess that the query should have a max and possibly some 'group by'
statements, but it's knowing where to put them.  Any hints greatly
appreciated.

TIA

David
Technical Details
Message-ID: <3df8712d@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 114a0e,54ae09d94673db75,start
X-Google-Attributes: gid114a0e,public
X-Google-ArrivalTime: 2002-12-12 03:39:08 PST
From: "DP" <daveperkins@_woo-hoo"-'#-bigfoot.com>
Newsgroups: borland.public.interbase.sql
Subject: JOIN and max query
Date: Thu, 12 Dec 2002 11:21:41 -0000
Lines: 31
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: 217.155.64.69
Message-ID: <3df8712d@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1039692077 217.155.64.69 (12 Dec 2002 03:21:17 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail