On Thu, May 21, 2009 06:02, Alban Hertroys wrote:
>
> But as people often say here, premature optimisation is a waste of
> time, so don't go that route unless you have a reason to expect
> problems in that area.
>
That was my very thought when I sent that message. On the other
hand, in case I w
On May 20, 2009, at 7:17 PM, James B. Byrne wrote:
Looking at this I have to wonder what will be the effect of having
tens of thousands of rate-pairs on file. Would this query be
improved by first doing a sub-query on base/quote pairs that
returned DISTINCT pairs and then do the IN condition usi
In article <43639.216.185.71.24.1242834374.squir...@webmail.harte-lyne.ca>,
"James B. Byrne" writes:
> What I want to be able to do is to return the most recent rate for
> all unique rate-pairs, irrespective of type. I also have the
> requirement to return the 5 most recent rates for each rate-p
James B. Byrne wrote:
On Wed, May 20, 2009 13:07, James B. Byrne wrote:
This seems to be working. I had to take a different approach as I
had misapprehended GROUP BY completely.
SELECT *
FROM currency_exchange_rates AS xchg1
WHERE id
IN (
SELECT id
FROM currency_exchange_rates as xc
On Wed, May 20, 2009 13:07, James B. Byrne wrote:
> This seems to be working. I had to take a different approach as I
> had misapprehended GROUP BY completely.
>
>
> SELECT *
> FROM currency_exchange_rates AS xchg1
> WHERE id
> IN (
> SELECT id
> FROM currency_exchange_rates as xchg2
>
James B. Byrne wrote:
On Tue, May 19, 2009 17:43, Andy Colson wrote:
.
What field is the source? currency_code_quote?
-Andy
Here is the layout of the table:
# Table name: currency_exchange_rates
#
# id :integer not null, primary key
# currency_code_base
This seems to be working. I had to take a different approach as I
had misapprehended GROUP BY completely.
SELECT *
FROM currency_exchange_rates AS xchg1
WHERE id
IN (
SELECT id
FROM currency_exchange_rates as xchg2
WHERE
xchg1.currency_code_base = xchg2.currency_code_base
On Tue, May 19, 2009 17:43, Andy Colson wrote:
.
>
> What field is the source? currency_code_quote?
>
> -Andy
>
Here is the layout of the table:
# Table name: currency_exchange_rates
#
# id :integer not null, primary key
# currency_code_base :string(3)
On May 19, 2009, at 11:29 PM, Andy Colson wrote:
I'm not sure what this will do:
HAVING
COUNT(fxr.currency_code_quote) = 1
The only time I have ever used HAVING is like:
select name from something group by name having count(*) > 1
to find duplicate name's.
That will leave out all
Andy Colson wrote:
James B. Byrne wrote:
I have a requirement to select the effective exchange rate for a
number of currencies as of a specific date and time. The rates may
come from several sources for the same currency. For some
currencies the rate may be set infrequently. I have come close
James B. Byrne wrote:
I have a requirement to select the effective exchange rate for a
number of currencies as of a specific date and time. The rates may
come from several sources for the same currency. For some
currencies the rate may be set infrequently. I have come close to
getting this to
James B. Byrne wrote:
On Tue, May 19, 2009 17:02, Andy Colson wrote:
so: select max(name), type from food group by type
works cuz we only get one name (the max name) back for each type.
or: select name, type from food group by type, name
which in our example is kinda pointless, but still, give
James B. Byrne wrote:
On Tue, May 19, 2009 16:41, Andy Colson wrote:
If your query above is getting you mostly what you want, just use it
as a derived table.
I lack the experience to understand what this means.
If, as you suggest, I use a subquery as the expression to the main
SELECT and fo
On Tue, May 19, 2009 17:02, Andy Colson wrote:
>
> so: select max(name), type from food group by type
> works cuz we only get one name (the max name) back for each type.
>
> or: select name, type from food group by type, name
> which in our example is kinda pointless, but still, give us the
> dis
On Tue, May 19, 2009 16:41, Andy Colson wrote:
> If your query above is getting you mostly what you want, just use it
> as a derived table.
>
I lack the experience to understand what this means.
If, as you suggest, I use a subquery as the expression to the main
SELECT and for it I use the synta
James B. Byrne wrote:
I have a requirement to select the effective exchange rate for a
number of currencies as of a specific date and time. The rates may
come from several sources for the same currency. For some
currencies the rate may be set infrequently. I have come close to
getting this to
James B. Byrne wrote:
I am perplexed why I cannot select a column from the table without
having to include it in the GROUP BY clause as well.
Any help is welcomed.
Group by is saying "I want only one row returned for each distinct value
in this column"
so a food table like this:
name |
I have a requirement to select the effective exchange rate for a
number of currencies as of a specific date and time. The rates may
come from several sources for the same currency. For some
currencies the rate may be set infrequently. I have come close to
getting this to work but cannot seem to
18 matches
Mail list logo