0

I'm trying what should be a simple task in Access. Basically to create a new table based on a string matching query. The Hazus_Schools table already exists in my database. The Hazus_Public does not, and I'm trying to create it. The PUBLIC field is a calculated column from another field. The following snippet

SELECT * FROM Hazus_Schools INTO Hazus_Public
WHERE Type = "PUBLIC";

Gives me the following error:

Syntax error in FROM clause

Any ideas what is wrong here?

user32882
  • 5,094
  • 5
  • 43
  • 82
  • Put `into` before `from`. – Gordon Linoff Jun 10 '16 at 12:12
  • I tried this SELECT * INTO Hazus_Public FROM Hazus_Schools WHERE Type = "PUBLIC"; but got another error "calculated columns are not allowed in SELECT INTO statements" How can I make the column non-calculated? – user32882 Jun 10 '16 at 12:14

1 Answers1

2

The order of your INTO and FROM is off, see W3schools Select Into

Try the following:

SELECT * 
INTO Hazus_Public
FROM Hazus_Schools
WHERE Type = "PUBLIC"
Tom Nijs
  • 3,835
  • 3
  • 22
  • 40
  • I'm still getting the error "Calculated Columns are not allowed in SELECT INTO statements". Please recall the "PUBLIC" field is a calculated column in Access – user32882 Jun 10 '16 at 12:26
  • If you google that error: 'Calculated columns are not allowed into SELECT INTO statements, the first link refers to a SO issue that will help you resolve this. It will involve creating a blank table with the same fields as your Hazus_Schools table and appending the SELECT INTO query to the Hazus_Public table. – Tom Nijs Jun 10 '16 at 12:31