Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Xbase Fox > Best Way to Pre...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 800 of 861
Post > Topic >>

Best Way to Prepend Aliases in SQL

by Gene Wirchenko <genew@[EMAIL PROTECTED] > Aug 23, 2007 at 10:09 AM

My app has some complex re****ts that require a number of selects
in order to build the table to re****t.  I use a lot of cursors.  To
keep track of them, I create a variable with the name.  I stuff the
value in an array and at the end, use a loop release the cursors.

     In a number of cases, I can use () to resolve the alias name as
below with alrawtrans in the from clause and alpcl in the into clause.
The problem is with column-names.  I have to go back to & as  with
"&alrawtrans..wonbr".

         SQLSEL;
          &alrawtrans..wonbr,;
          sum(int(quantity)) as cpcl,sum(qty2) as tweight;
         from (alrawtrans);
         inner join cwko on cwko.wonbr=&alrawtrans..wonbr;
         inner join ccat on ccat.wocatype=cwko.wocatype;
         where;
          left(funccode,len(alltrim(wfcpref)))=wfcpref and;
          chgcli in ("P","Y");
         group by &alrawtrans..wonbr;
         into cursor (alpcl) nofilter

     Because there are two wonbr, I can not simply drop the
"&alrawtrans..".

          (alrawtrans).wonbr
does not work.  (I really wish it would).  I could use
          (alrawtrans+".wonbr")
but that is worse than & for readability.

     What do you use?

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
     I have preferences.
     You have biases.
     He/She has prejudices.
 




 4 Posts in Topic:
Best Way to Prepend Aliases in SQL
Gene Wirchenko <genew@  2007-08-23 10:09:43 
Re: Best Way to Prepend Aliases in SQL
"Lew" <lew@[  2007-08-23 13:16:02 
Re: Best Way to Prepend Aliases in SQL
Gene Wirchenko <genew@  2007-08-23 12:43:35 
Re: Best Way to Prepend Aliases in SQL
"Lew" <lew@[  2007-08-23 13:23:58 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 14:05:59 CST 2008.