dbTalk Databases Forums  

SQL query - Help...

comp.databases.xbase.fox comp.databases.xbase.fox


Discuss SQL query - Help... in the comp.databases.xbase.fox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
ShahJagat
 
Posts: n/a

Default SQL query - Help... - 08-13-2003 , 09:59 PM






Hi -

I have a table that captures the prices on the items purchased and the date
they were purchased. So this tabel would have mutiple records on the same item
since the item was purchased mutiple times.

How can I do a SQL query where it will list each item only once and the its
latest price?

Thanks in advance...

Shah

Reply With Quote
  #2  
Old   
Kuido Külm
 
Posts: n/a

Default Re: SQL query - Help... - 08-14-2003 , 05:21 AM






use self-correlated query

select a.itemcode, a.itemdate, a.itemprice form sourcetable a ;
where a.itemdate = (select max(b.itemdate) form sourcetable b where
a.itemcode = b.itemcode) into cursor result



ShahJagat wrote:
Quote:
Hi -

I have a table that captures the prices on the items purchased and the date
they were purchased. So this tabel would have mutiple records on the same item
since the item was purchased mutiple times.

How can I do a SQL query where it will list each item only once and the its
latest price?

Thanks in advance...

Shah


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.