I don't think you can SELECT INTO when you may have multiple results and the
LIMIT won't help. Basically you need:
SELECT DISTINCT gl_acct FROM gl_pur_01 WHERE gl_acct IS NOT NULL
To put the results into a variable you might need a CURSOR loop,
alternatively you could use this statement as the sub-select clause for some
other operation.
hope this helps,
Bill Cook
Kent WA
----- Original Message -----
From: "Jim Limburg" <[EMAIL PROTECTED]>
To: "RBase Listserv" <[EMAIL PROTECTED]>
Sent: Friday, June 22, 2001 6:36 AM
Subject: Will the real Sub-Select please stand up
> G-Day all
>
> I started out this morning to do what I thought a simple thing. To build
> a sub-select statement that would return into a variable the values in a
> column that are not null and distinct even if it is in the column more
> than once..
>
> I want the variable to contain 6090,7010,4050,1320,1590 ... and so on...
>
> The data in the columns is text/12 and here is what I attempted so far.
>
> SELECT gl_acct INTO vg_gl_acct FROM gl_pur_01 WHERE gl_acct IN +
> (SELECT gl_acct FROM gl_pur_01 where gl_acct is not null and limit=1)
>
> Thanks
> Jim Limburg