Subject Re: Composite vs single column keys
Author sboydlns
--- In firebird-support@yahoogroups.com, Svein Erling Tysvær <svein.erling.tysvaer@...> wrote:
>
>
>
> I think
>
> SELECT *
> FROM GLJOUR
> WHERE Company >= :Company
> AND (Company > :Company
> OR (Account >= :Account
> AND (Account > :Account
> OR (Division >= :Division
> AND (Division > :Division
> OR (Department >= :Department
> AND (Department > :Department
> OR (EffectiveDate >= :EffectiveDate
> AND (EffectiveDate > :EffectiveDate
> OR ControlNumber >= : ControlNumber)))))))))
>
> will achieve the same thing with lesser code.
>

Actually I don't think that will give me what I want. Consider:

I want to start reading start at Company = 10 and Account = 1000. That means I should get all of Company 10 where Account >= 1000 and all of Company 11, 12, 13, ... irregardless of the value of Account.

That is I should get 10-1000, 10-1001, ... and 11-0001, 11-0002, ...

I don't think that the above WHERE clause will give me that.

> Regarding the programmers opposing changing to a database, I would actually suggest that you implement something like they want. However, I would also recommend you to tell them it is like trying to make a sports car behave like a train and ask them if you could be allowed to change one (smallish, but sluggish) program so that it utilized Firebird the way it was intended to (and then let them compare the two versions).

I am implementing something like what they want. Or at least I am trying to. Performance will definitely be sub-optimal but they aren't going to believe until they see it.