> Jim Limburg wrote:
> I still don't see it, but that's OK as well.. from what Scott's
> explaining in another branch of this thread, I kinda understand
> it... I have even used his method without really understanding it..
> I just wanted a little more background of how this could be used
> and why it works.

Jim,

Try this:

R>
SET VAR x = 'Jim Limburg'

SELECT .x FROM Sys_Tables WHERE LIMIT = 1

SELECT .x, Sys_Table_Name FROM Sys_Tables WHERE LIMIT = 1

SELECT .x, 'ThisAndThat', Sys_Table_Name +
       FROM Sys_Tables WHERE LIMIT = 1

Oh, make sure you   SET HEAD ON
You'll be able to see the headings where the column
names would normally be, there will be the literal text
of what you selected.  And so it is possible to select
data from a table that isn't actually in that table.

This type of thing is especially helpful when you go to
fill a table by using a SELECT command.

INSERT INTO TableName (Column1, Column2, Column3) +
     SELECT ('1', ColumnA, ColumnB) +
     FROM TableNameTwo +
     WHERE IdColumn = .vIdValue

You would do this when you want to fill a table with
some data from another table and you want to fill it
with constant data at the same time.  This saves you
from having to come back with an update later.  This
is also useful to identify an inserted record back in
the days before WHERE COUNT = INSERT

Also...  This is the same methodology that is used
when you do something like this:

SELECT Sys_Table_Id, (Sys_Table_Id - 10) +
     FROM Sys_Tables

Of course, subtracting 10 from the Sys_Table_Id value
isn't of much use but you can see here that if you were
selecting your gross sales figures and you wanted to see
them with sales tax, you could do it right from the table.

SELECT GrossSales, (GrossSales * 1.086) +
     FROM SalesTable +
     WHERE ....

You could also do this (but it only works from the R>):

SELECT GrossSales=S, (GrossSales * 1.086)=S +
     FROM SalesTable +
     WHERE ....

Hope this helps.

Scott
====
Scott J. Salisbury
Matrix Data Systems / The R:Street Journal
5114 Point Fosdick Drive NW, Suite E-272
Gig Harbor, WA 98335-1733

E-Mail Address: [EMAIL PROTECTED]
Temporary URL: www.seanet.com/~sjs  (downloads available)
New Web Address: www.rStreetJournal.Com
Direct Line: 206-423-7679
Toll Free: 888-386-5040
Seattle: 206-448-7975
Fax: 305-425-0491
 

Reply via email to