SQL query

SQL query

Post by A » Sat, 05 Jul 2003 22:45:54



I have got a table which contains the following column and data.

DateField   Amount
01/01/03        5
02/01/03        10
03/01/03        10
04/01/03        10
05/01/03        13
06/01/03        5
07/01/03        5
08/01/03        30
09/01/03        10
10/01/03        10
11/01/03        30

How do I retrieve the following values without the use of cursor or
doing row based processing.

DateField       Amount
01/01/03          5
04/01/03        10  (the max date for this value before it changes  to
13.)
05/01/03        13
07/01/03         5 (the max date for this value before it changes  to
13.)
08/01/03        30
10/01/03        10 (the max date for this value before it changes  to
13.)
11/01/03        30

Regards
AK

 
 
 

SQL query

Post by nnnnn » Sun, 06 Jul 2003 04:28:38


search google for "characteristic functions"


Quote:> I have got a table which contains the following column and data.

> DateField   Amount
> 01/01/03 5
> 02/01/03 10
> 03/01/03 10
> 04/01/03 10
> 05/01/03 13
> 06/01/03 5
> 07/01/03 5
> 08/01/03 30
> 09/01/03 10
> 10/01/03 10
> 11/01/03 30

> How do I retrieve the following values without the use of cursor or
> doing row based processing.

> DateField       Amount
> 01/01/03          5
> 04/01/03        10  (the max date for this value before it changes  to
> 13.)
> 05/01/03        13
> 07/01/03         5 (the max date for this value before it changes  to
> 13.)
> 08/01/03        30
> 10/01/03        10 (the max date for this value before it changes  to
> 13.)
> 11/01/03        30

> Regards
> AK


 
 
 

1. Getting SQL queries to the Emulator SQL Query

I have a database loaded on the Emulator and would like to run queries
that I have in my WinXP environment on SQLCE Query.  I tried several
options with various problems -

1.  I tried to copy the query from WinXP Query Analyzer to the
Emulator SQLCE Query.  Nothing pastes when I try this.  So, I assume
that you can't transfer text from the WinXP clipboard to the Emulator
SQL CE Query clipboard.  Is this correct?

2.  I made a sql.txt file that I added to my .NET project.  This
project and my sql.txt file gets deployed to "\program
files\xyz\sql.txt" on the emulator.  So, now I have sql.txt on the
emulator.  But, with the emulator's SQL Query, I can only open folders
under the "My Documents" folder.  In otherwords, I can't get to
"\program files\xyz\sql.txt" folder/file.

I must be overlooking something obvious...

Thanks...

2. Sybase FORTRAN pre-compiler: Wanted

3. UK query - Delphi3 - NT4-Memory leak on SQL Query to SQL/server 6.5

4. WillChangeField

5. Subject: SQL Query - MAX, Grouping and Sub query

6. OLTP DATABASE DEFINITION

7. SQL Query to query a view with a changing name

8. Oracle DBMS Alert - Notify using Delphi

9. Access Query to SQL Query

10. Converting MS Access Query to MS SQL Query

11. Query fails on VB6 but runs on VB5 and SQL Query Tool

12. Query works in SQL Query Analyzer but doesn't work in DTS

13. Difference between dynamic sql query and a normal query