🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: SQL Query - subquery ?

#704
From: joseph
Date: Thu, 26 Jul 2007 13:29
37 lines
1969 bytes
I think you need something like this:


select o1.article_no, o1.order_date, o1.price
from order o1
where o1.order_date =
(select min(o2.order_date)
 From Order o2
 Where o2.article_no = o1.article_no)


not tested. good luck.


Joseph


"RL912" <rl@werkstatt22.de> wrote in message
news:46a8795d$1@newsgroups.borland.com...
> Hello,
> I have a table containing Order Data. For this case significant are
> Article_no, order_date and price.
> The order records are generated from customers orders, so that the order
> "5 pcs of 12345, ordered on 01.01.2000 for 12,50$" is translated into "1
> of 5 of 12345 from 01.01.2000 for 12,50$;2 of 5 of 12345 from 01.01.2000
> for 12,50$;3 of 5 of 12345 from 01.01.2000 for 12,50$" and so forth.
> Now I need to query price changes from this table in a way, that I get a
> list containing
> article_no, order_date, price
> where order_date is the date, this price is used for this article for
> the first time.
>
> I am not really used to sql and did not find a solution.
>
> TIA
>
> Rolf
Technical Details
Message-ID: <46a8a1c1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <46a8795d$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,6e40cb137d867437
X-Google-Attributes: gid114a0e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "joseph" <jpell@di-ve.com>
Newsgroups: borland.public.interbase.sql
References: <46a8795d$1@newsgroups.borland.com>
Subject: Re: SQL Query - subquery ?
Date: Thu, 26 Jul 2007 15:29:35 +0200
Lines: 39
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1807
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1896
NNTP-Posting-Host: 194.158.51.158
Message-ID: <46a8a1c1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1185456577 194.158.51.158 (26 Jul 2007 06:29:37 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
X-Original-Bytes: 1816