J
John T Ingato
I have a query that was written a while ago that used a temp table which was
deleted. I would like to use this query again. So I replaced the temp
table's name with the new (permanent) name in the queries SQL and I could
not get the query to run.
So I copied the new table and renamed it what the old (temp) name was
(table4). It ran.
So here's the curious part.
I open the query in SQL mode and run it. It runs! See SQL below.
If I change any of the words in the SQL it won't run, even if I change the
words to the same words.
For example, if I delete an "S" and then put the "S" right back, it won't
run. I have to close the query, unsaved, and re-open it. Then it runs.
Even if I add a space between any two letters, then backspace to remove it,
it won't run.
The error is always the same: "Syntax error in FROM clause." The very last
FROM is highlighted.
Any ideas?
SELECT A.ItemNumber, A.Stores, B.[YTD Units]
FROM [SELECT ItemNumber, Count(StoreNumber) AS Stores
FROM
(SELECT Distinct ItemNumber, StoreNumber
FROM table4) AS T
GROUP BY ItemNumber]. AS A INNER JOIN [SELECT ItemNumber, Sum(Sold) AS
[YTD Units]
FROM table4
GROUP BY ItemNumber]. AS B ON A.ItemNumber=B.ItemNumber;
deleted. I would like to use this query again. So I replaced the temp
table's name with the new (permanent) name in the queries SQL and I could
not get the query to run.
So I copied the new table and renamed it what the old (temp) name was
(table4). It ran.
So here's the curious part.
I open the query in SQL mode and run it. It runs! See SQL below.
If I change any of the words in the SQL it won't run, even if I change the
words to the same words.
For example, if I delete an "S" and then put the "S" right back, it won't
run. I have to close the query, unsaved, and re-open it. Then it runs.
Even if I add a space between any two letters, then backspace to remove it,
it won't run.
The error is always the same: "Syntax error in FROM clause." The very last
FROM is highlighted.
Any ideas?
SELECT A.ItemNumber, A.Stores, B.[YTD Units]
FROM [SELECT ItemNumber, Count(StoreNumber) AS Stores
FROM
(SELECT Distinct ItemNumber, StoreNumber
FROM table4) AS T
GROUP BY ItemNumber]. AS A INNER JOIN [SELECT ItemNumber, Sum(Sold) AS
[YTD Units]
FROM table4
GROUP BY ItemNumber]. AS B ON A.ItemNumber=B.ItemNumber;