exchange rate+date

  • Thread starter Thread starter J.J.
  • Start date Start date
J

J.J.

hi
I have a table where I enter dates (Date_Field) and exchange rates (ERate_Field) for every day.
In query I have field Payment_date. Now I must make my query to use only one exchange rate
reffering to Payment_date.
For example:
Table has three records (for now)

1. Date_Field=05/06
ERate_Field=7,3

2. Date_Field=07/07
ERate_Field=7,4

3. Date_Field=05/08
Erate_Field=7,5

In query teh ERate_Field must be as follows

1. Payment_date till 05/06
ERate_Field=7,3

2. Payment_date=15/06
ERate_Field=7,4

3. Payment_date=31/06
ERate_Field=7,4

4. Payment_date=15/07
ERate_Field=7,5

5. Payment_date from 05/08
ERate_Field=Null

Thanks a lot for quick qnswer
J.J.
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Your query needs to use the ORDER BY clause.

SELECT payment_date, erate_field
FROM table_name
WHERE ... criteria ...
ORDER BY payment_date, erate_field

Note: NULL values usually sort to the top of ASCending sorts and to the
bottom of DESCending sorts.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQRKAFoechKqOuFEgEQLf8gCeMDUV+QbqU51olkyZuy2+jZbvHCIAoML1
/QVxTp6Fx/X988vkb16aMmAR
=GzY/
-----END PGP SIGNATURE-----
 
what about the criteria?
MGFoster said:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Your query needs to use the ORDER BY clause.

SELECT payment_date, erate_field
FROM table_name
WHERE ... criteria ...
ORDER BY payment_date, erate_field

Note: NULL values usually sort to the top of ASCending sorts and to the
bottom of DESCending sorts.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQRKAFoechKqOuFEgEQLf8gCeMDUV+QbqU51olkyZuy2+jZbvHCIAoML1
/QVxTp6Fx/X988vkb16aMmAR
=GzY/
-----END PGP SIGNATURE-----
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Your output example appeared to indicate that you wanted to know how to
sort the payment_date and the erate_field. I don't know which records
you want from your table. You'll have to provide your own criteria.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQRZ9fYechKqOuFEgEQLo4QCgjK+J+mucyW8g8MYjC7rnZVqMdWAAn2D5
boQrTYwnc0a0iYapUoRBdsp9
=WK9p
-----END PGP SIGNATURE-----
 
maybe i put it wrong, the criteria in query must be
date_field>payment_date but only the first date_filed that is bigger than
payment_date not all of them

JJ
 
Back
Top