Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread select from non-existing table
Fri, Nov 28 2008 7:08 PMPermanent Link

John
Hello.

I need to be able to create a select statement, which returns a list of simple values.
Example: (return values)
a
b
c
..
Example 2: (return values)
1
2
3
..

Of course, I could just create these tables, insert a bunch of values into them, and then
select from these tables. But is not there some way to select values from a non-exisiting
table, and supply the wanted return values in the sql statement?
Fri, Nov 28 2008 8:04 PMPermanent Link

"Robert"

"John" <eydunl@post.olivant.fo> wrote in message
news:18901C13-2F0C-448C-8FD9-674A1D4D3375@news.elevatesoft.com...
> Hello.
>
> I need to be able to create a select statement, which returns a list of
> simple values.
> Example: (return values)
> a
> b
> c
> .
> Example 2: (return values)
> 1
> 2
> 3
> .
>
> Of course, I could just create these tables, insert a bunch of values into
> them, and then
> select from these tables. But is not there some way to select values from
> a non-exisiting
> table, and supply the wanted return values in the sql statement?
>

kind of. you still need a real existing table to satisfy the syntax of
select

select distinct 1, 2, 3 from atable

it does not matter what the contents of atable are, as long as it has at
least one row.

robert

Sat, Nov 29 2008 4:49 AMPermanent Link

"Malcolm"
Robert wrote:

>
> "John" <eydunl@post.olivant.fo> wrote in message news:18901C13-2F0C-448C-8FD9-674A1D4D3375@news.elevatesoft.com...
> > Hello.
> >
> > I need to be able to create a select statement, which returns a list of  simple values.
> > Example: (return values)
> > a
> > b
> > c
> > .
> > Example 2: (return values)
> > 1
> > 2
> > 3
> > .
> >
> > Of course, I could just create these tables, insert a bunch of values into  them, and then
> > select from these tables. But is not there some way to select values from  a non-exisiting
> > table, and supply the wanted return values in the sql statement?
> >
>
> kind of. you still need a real existing table to satisfy the syntax of select
>
> select distinct 1, 2, 3 from atable
>
> it does not matter what the contents of atable are, as long as it has at least one row.
>
> robert

And, if the values are in variables, try something like:

SELECT IntToStr(SomeIntVar), QuotedStr(SomeStringVar), .... from ATable;

Malcolm

--
Sat, Nov 29 2008 11:34 AMPermanent Link

John
Thanks. As I see it, that always return just one record. Is there a method to
retrieve more than one record?
Sat, Nov 29 2008 2:53 PMPermanent Link

"Robert"

"John" <eydunl@post.olivant.fo> wrote in message
news:D82FA233-F8B5-4F9E-8898-F01D566A1009@news.elevatesoft.com...
> Thanks. As I see it, that always return just one record. Is there a method
> to
> retrieve more than one record?
>

The DISTINCT forces just one record, since all rows selected are the same.
Eliminating DISTINCT will select one row for each row in ATable.

Robert

Image