Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Ken Murphy
  Where is Ken Murphy?
 Springhill
 Canada
 Ken Murphy
 To: Borislav Borissov
  Where is Borislav Borissov?
 Sofia
 Bulgaria
 Borislav Borissov
 Tags
Subject: RE: Sql command not running at first pass
Thread ID: 104266 Message ID: 104432 # Views: 1 # Ratings: 0
Version: Visual FoxPro 6 Category: Databases, Tables and SQL Server
Date: Wednesday, August 16, 2006 2:07:10 PM         
   


> > I am running following SQL command
> >
SELECT Pomast.pono, Pomast.podate, Pomast.rate, Heading.rate,;
> >   Pomast.heading, Pomast.scode, Taxrate.tax_rt;
> >  FROM  pomast INNER JOIN heading;
> >     INNER JOIN taxrate ;
> >    ON  Pomast.scode = Taxrate.maincode ;
> >    ON  Pomast.heading = Heading.tarrifhead

> > When run for the first time it gives error as "sql column scode not found".
> > but if the same command is repeated it gives proper results.
> > What could be the cause. (the sql command was copied form the query bulider)
> > LInk below gives the tables I am using.
> >
> > Ulhas Amrite
> >
> > https://www.foxite.com/uploads/66bb6080-a593-41e9-a7bc-26b24384f238.zip

>
> Your sequence on JOIN and ON are not the same. That is why I prefer always to put ON after JOIN. Try:
>
> SELECT Pomast.pono, Pomast.podate, Pomast.rate, Heading.rate,;
>        Pomast.heading, Pomast.scode, Taxrate.tax_rt;
> FROM pomast;
> INNER JOIN heading ON  Pomast.heading = Heading.tarrifhead;
> INNER JOIN taxrate ON  Pomast.scode   = Taxrate.maincode
> 

>
> Borislav Borissov
>
>


Borislav,

The sequence is not supposed to matter. Two JOIN clauses followed by two ON clauses should work. The command evaluates the table alias in the ON clause to determine which JOIN it applies to. I do agree with your style however. Placing the ON directly after the appropriate JOIN makes it far mor readable. As to why this is throwing an error? Could the use of Heading as a file name be an issue? Heading shows up in blue print in intellisense.

Ken
You shall know the truth - and the truth shall set you free. (John 8:33)

ENTIRE THREAD

Sql command not running at first pass Posted by Ulhas Amrite @ 8/14/2006 12:30:45 PM
RE: Sql command not running at first pass Posted by Ralph Toledo @ 8/14/2006 12:55:19 PM
RE: Sql command not running at first pass Posted by Borislav Borissov @ 8/14/2006 1:05:08 PM
RE: Sql command not running at first pass Posted by Ulhas Amrite @ 8/14/2006 8:19:25 PM
RE: Sql command not running at first pass Posted by Borislav Borissov @ 8/14/2006 8:29:55 PM
RE: Sql command not running at first pass Posted by Ken Murphy @ 8/16/2006 2:07:10 PM
RE: Sql command not running at first pass Posted by Borislav Borissov @ 8/16/2006 2:36:28 PM