Subject | Sets of fields |
---|---|
Author | Jonathan Neve |
Post date | 2006-03-21T13:21:38Z |
Hi all,
I have an idea of a feature which would be useful, or so it seems to me.
Perhaps this has already been thought of, and perhaps I am not using the
right terms to describe it, but at any rate, I'd like to know what you
think.
I think it would be useful to be able to handle "sets" of fields, that
is, be able to manipulate and compare sets of fields to sets of values,
rather than deal with them each one by one. A common example of this
would be the case where a sub-select is used in a query, and two
separate fields need to be returned: there is currently no way to handle
this other than to duplicate the sub-select. It would be nice to be able
to write something like:
select a, b, c, (select t2.a, t2.b from table2 t2 where t2.code = t1.d)
as (d, e)
from table1 t1
Another case use would be in the where clause, in order to compare sets
of values (for example, with a multi-field primary key):
select a, b, c from table
where (d, e) in ((1, 2), (2, 1), (4, 6))
(Please not that this query is very different from
select a, b, c from table
where d in (1, 2, 4) and e in (2, 1, 6))
Or it could also be used like this:
select a, b, c from table
where (day, hours, minutes) < (:day, :hours, :minutes)
This last query is particularly difficult to make in the current state
of affairs!
Again, if something like this, or something that addresses the same
problems differently, has already planned, or perhaps even implemented,
please let me know.
--
Best regards,
Jonathan Neve
_______________
CopyTiger - advanced database replicator for Interbase/Firebird!
Web : http://www.microtec.fr/copycat/ct
_______________________________________
CopyCat - database replication components for Delphi/C++Builder!
Web : http://www.microtec.fr/copycat/cc
I have an idea of a feature which would be useful, or so it seems to me.
Perhaps this has already been thought of, and perhaps I am not using the
right terms to describe it, but at any rate, I'd like to know what you
think.
I think it would be useful to be able to handle "sets" of fields, that
is, be able to manipulate and compare sets of fields to sets of values,
rather than deal with them each one by one. A common example of this
would be the case where a sub-select is used in a query, and two
separate fields need to be returned: there is currently no way to handle
this other than to duplicate the sub-select. It would be nice to be able
to write something like:
select a, b, c, (select t2.a, t2.b from table2 t2 where t2.code = t1.d)
as (d, e)
from table1 t1
Another case use would be in the where clause, in order to compare sets
of values (for example, with a multi-field primary key):
select a, b, c from table
where (d, e) in ((1, 2), (2, 1), (4, 6))
(Please not that this query is very different from
select a, b, c from table
where d in (1, 2, 4) and e in (2, 1, 6))
Or it could also be used like this:
select a, b, c from table
where (day, hours, minutes) < (:day, :hours, :minutes)
This last query is particularly difficult to make in the current state
of affairs!
Again, if something like this, or something that addresses the same
problems differently, has already planned, or perhaps even implemented,
please let me know.
--
Best regards,
Jonathan Neve
_______________
CopyTiger - advanced database replicator for Interbase/Firebird!
Web : http://www.microtec.fr/copycat/ct
_______________________________________
CopyCat - database replication components for Delphi/C++Builder!
Web : http://www.microtec.fr/copycat/cc