Subject | [firebird-support] Select RANDOM(x) from .... |
---|---|
Author | Martin Dew |
Post date | 2005-04-13T09:45:04Z |
Hi.
I really need to be able to do something like the following;
CREATE PROCEDURE ACC_QS4B (
DATEFROM DATE,
DATETO DATE,
CONS_BY VARCHAR(5),
HOWMANY INTEGER
) RETURNS (
URN INTEGER
) AS
BEGIN
FOR
SELECT
RANDOM(:HOWMANY) l.urn
FROM
log l
left outer join patient p on (l.urn = p.log_urn)
WHERE
(l.taken_at >= :DATEFROM
and
l.taken_at <= :DATETO)
and
p.Last_cons_by = :CONS_BY
INTO
:URN
DO BEGIN
SUSPEND;
END
END
Where the SELECT RANDOM(:HOWMANY) tells it to return only the amount of
records specified by :HOWMANY and also to randomise its selection of
these :HOWMANY records.
Can anyone tell me if this can be done in FB 1.5.1 ?
T.I.A
Martin
[Non-text portions of this message have been removed]
I really need to be able to do something like the following;
CREATE PROCEDURE ACC_QS4B (
DATEFROM DATE,
DATETO DATE,
CONS_BY VARCHAR(5),
HOWMANY INTEGER
) RETURNS (
URN INTEGER
) AS
BEGIN
FOR
SELECT
RANDOM(:HOWMANY) l.urn
FROM
log l
left outer join patient p on (l.urn = p.log_urn)
WHERE
(l.taken_at >= :DATEFROM
and
l.taken_at <= :DATETO)
and
p.Last_cons_by = :CONS_BY
INTO
:URN
DO BEGIN
SUSPEND;
END
END
Where the SELECT RANDOM(:HOWMANY) tells it to return only the amount of
records specified by :HOWMANY and also to randomise its selection of
these :HOWMANY records.
Can anyone tell me if this can be done in FB 1.5.1 ?
T.I.A
Martin
[Non-text portions of this message have been removed]