Subject Re: [firebird-support] Re: Help with query, bit confused
Author William L. Thomson Jr.
Adam,

On Tue, 2005-12-27 at 23:34 +0000, Adam wrote:
> Hi William,
>
> Do your self a favour and do not use a timestamp as your primary key.

Already changed, thanks for the suggestion.

> Secondly, I think your confusion lies in that you expect the IN
> statement to be evaluated into a list of constants, where IN is
> actually implemented by being evaluated each row.

Yes, I am totally confused about IN statements. If I have an inner query
limited to 3 primary keys. Should that not limit the outer query to
returning only results with those primary keys? With no other
conditions, it seems the outer should return only 3 rows.

COL1 has 10 rows with values 1-10 in them

SELECT * FROM MY_TABLE WHERE COL1 IN
(SELECT LAST 3 COL1 FROM MY_TABLE)

Is that not the same as

SELECT * FROM MY_TABLE WHERE COL1=1 OR COL1=2 OR COL1=3

> The same sort of issue occurs when you try
>
> insert into a
> select * from a;
>
> Maybe its the standard, maybe its a bug, either case it doesn't behave
> how you want so you need to do it another way.

That sucks

Thank you for your suggestion. However I do not want to create and use
another table. I ended up just doing a bit more client side than I had
wanted to, but got the funcationality I was after and am moving on.

--
Sincerely,
William L. Thomson Jr.
Obsidian-Studios, Inc.
http://www.obsidian-studios.com