If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Insert Into syntax help
Using Office 2003 and Windows XP;
Can someone please help me clear the syntax error I'm getting from this SQL?: INSERT INTO Table1 AS A SELECT B.SAL_ADMIN_PLAN, B.PAY_GRADE, B.ANNUAL_MIN, B.ANNUAL_MID, B.ANNUAL_MAX FROM Table2 AS B WHERE (A.SAL_ADMIN_PLAN B.SAL_ADMIN_PLAN AND A.PAY_GRADE B.PAY_GRADE); Note that in the WHERE clause both specs must be true; As you may be able to tell, I am not that good with SQL; please help. Thanks much in advance. |
#2
|
|||
|
|||
Insert Into syntax help
You are referring to Table1 in the SELECT query. To do so, it must be in
the FROM clause of the SELECT query. I also assume that you are creating Table1 or that Table1 has exactly 5 fields and in the order that you specified in SELECT query. INSERT INTO Table1 AS A SELECT B.SAL_ADMIN_PLAN , B.PAY_GRADE , B.ANNUAL_MIN , B.ANNUAL_MID , B.ANNUAL_MAX FROM Table2 AS B RIGHT JOIN Table1 as C ON A.SAL_ADMIN_PLAN = C.SAL_ADMIN_PLAN AND A.PAY_GRADE = C.PAY_GRADE WHERE C.SAL_ADMIN_PLAN IS NULL A good way to handle this type of thing is to construct just the Select query first and see if it returns the records and fields you want. Once that is done, then add the INSERT part of the append query. -- John Spencer Access MVP 2002-2005, 2007 Center for Health Program Development and Management University of Maryland Baltimore County .. "XP" wrote in message ... Using Office 2003 and Windows XP; Can someone please help me clear the syntax error I'm getting from this SQL?: INSERT INTO Table1 AS A SELECT B.SAL_ADMIN_PLAN, B.PAY_GRADE, B.ANNUAL_MIN, B.ANNUAL_MID, B.ANNUAL_MAX FROM Table2 AS B WHERE (A.SAL_ADMIN_PLAN B.SAL_ADMIN_PLAN AND A.PAY_GRADE B.PAY_GRADE); Note that in the WHERE clause both specs must be true; As you may be able to tell, I am not that good with SQL; please help. Thanks much in advance. |
#3
|
|||
|
|||
Insert Into syntax help
Please note that Table1 already includes some of the records in Table2; I am trying to get only those that did not match other criteria. "XP" wrote: Using Office 2003 and Windows XP; Can someone please help me clear the syntax error I'm getting from this SQL?: INSERT INTO Table1 AS A SELECT B.SAL_ADMIN_PLAN, B.PAY_GRADE, B.ANNUAL_MIN, B.ANNUAL_MID, B.ANNUAL_MAX FROM Table2 AS B WHERE (A.SAL_ADMIN_PLAN B.SAL_ADMIN_PLAN AND A.PAY_GRADE B.PAY_GRADE); Note that in the WHERE clause both specs must be true; As you may be able to tell, I am not that good with SQL; please help. Thanks much in advance. |
Thread Tools | |
Display Modes | |
|
|