Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax Changed by Query designer when editing a sub query

Status
Not open for further replies.

ClayGoss

Programmer
Jan 3, 2005
2
Has anyone seen this behavior? I enter the following query into the Query Design, SQL view:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SELECT [Freight Rates].*
FROM [Freight Rates]
INNER JOIN (SELECT [Freight Rates].siteno,
[Freight Rates].vendorid,
max([freight rates].effective) AS effective
FROM [Freight Rates]
WHERE [Freight Rates].Effective <= ThisDate
GROUP BY [Freight Rates].siteno, [Freight Rates].vendorid) AS SubEff
ON (SubEff.SiteNo = [Freight Rates].SiteNo)
AND (SubEff.VendorID = [Freight Rates].VendorID)
AND (SubEff.Effective = [Freight Rates].Effective)
ORDER BY [Freight Rates].SiteNo, [Freight Rates].VendorID;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I save it, run it, all is well. :)

Oh, I need to make a "tweek" to it and open the Design/Sql View and here is what I see:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SELECT [Freight Rates].*
FROM [Freight Rates]
INNER JOIN [SELECT [Freight Rates].siteno,
[Freight Rates].vendorid,
max([freight rates].effective) AS effective
FROM [Freight Rates]
WHERE [Freight Rates].Effective <= ThisDate
GROUP BY [Freight Rates].siteno, [Freight Rates].vendorid]. AS SubEff
ON (SubEff.Effective = [Freight Rates].Effective)
AND (SubEff.VendorID = [Freight Rates].VendorID)
AND (SubEff.SiteNo = [Freight Rates].SiteNo)
ORDER BY [Freight Rates].SiteNo, [Freight Rates].VendorID;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Notice the "(" and ")" have been replaced by "[" and "]" respectively and a period has been added after the "]". This syntax is not valid, if I make a trivial change, like adding a space somewhere, it will not save siting a "Syntax erron in FROM clause."

I have been working around this behavior by keeping a copy of the SQL statement in a text file and doing my edits there and pasting into the Design/SQL View window.

Any thoughts? Ideas?
 
Its a bug of the query designer.
The work around, provided the subquery is not correlated, is to use saved query.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top