RE: Is this SQL Possible??

  • From: "Grant Allen" <Grant.Allen@xxxxxxxxxxxxxxxx>
  • To: <Oracle-l@xxxxxxxxxxxxx>
  • Date: Tue, 21 Dec 2004 09:57:07 +1100

Hi Ben,

I haven't seen anyone mention this, so I'll throw it in to the mix.  One =
of the OLAP options that's been around since 8i is SAMPLE, which does =
almost exactly what you want.  The only gotcha is you can specify =
percentage of table, or blocks, to randomly grab ... not number of rows. =
 You could play around to see if a ridiculously low percentage always =
returns one row (the lower bound is .000001%).

Ciao
Fuzzy
:-)

----------------------------------
"Everything you think, do, and say
 was in the pill you took today."
 -- Zager and Evans

----------------------------------
"Everything you think, do, and say
 was in the pill you took today."
 -- Zager and Evans

> -----Original Message-----
> From: oracle-l-bounce@xxxxxxxxxxxxx
> [mailto:oracle-l-bounce@xxxxxxxxxxxxx]On Behalf Of Ben Sauer
> Sent: Tuesday, 21 December 2004 06:11
> To: Oracle-l@xxxxxxxxxxxxx
> Subject: Is this SQL Possible??
>=20
>=20
> I have a many to one relationship from table b to table a.  =20
> In other words,
> in
> table A I have people and in table B I have assignments.  I=20
> need to write a
> query to pick up a set of users in table A and just one of=20
> their assignments.
> I
> don't even care which one.  Is there a way to do that elegantly?
> =20
> I thought this would work... but it's just too time consuming.
> =20
> SELECT *
>   FROM ss,
>        (SELECT "Support Staff ID", "Group ID"
>           FROM gd WHERE "Full Name" IN (SELECT DISTINCT "Full Name"
>                                           FROM gd))
>  WHERE ss.code =3D "Support Staff ID"
> Thanks,
> Ben.
>=20
> --------------------------------------------------------------
> ----------------
> This message may contain confidential information, and is
> intended only for the use of the individual(s) to whom it
> is addressed.
> --------------------------------------------------------------
> ----------------
>=20
>=20
> --
> //www.freelists.org/webpage/oracle-l
>=20
--
//www.freelists.org/webpage/oracle-l

Other related posts: