INSERT INTO Employee_Status ( [Employee Name], [Employee ID] )
SELECT [Employee List].[Employee Name], [Employee List].[Employee ID]
FROM [Employee List]
WHERE ((([Employee List].[Employee ID]) <> [Employee_Status].[Employee ID]));
I have no control over a linked table [Employee List] coming from managment
dept. I want to query to insert all employees and ids to another table called
Employee_Status (this table I will be able to create new columns such as
status on them) . That way, I can update either active/not active and create
reports/sign in sheets based on active employees only. I don't want to delete
non active employees. I know this sounds very spagetti. Will you please tell
how I can populate the table Employee_Status with the linked table Employee
List?
Thanks, Misty
--
Message posted via http://www.accessmonster.com
|
|
0
|
|
|
|
Reply
|
Mitchell_Collen
|
11/29/2007 5:09:45 PM |
|
"Mitchell_Collen via AccessMonster.com" <u33726@uwe> wrote in message
news:7bf24d7c58c0f@uwe...
> INSERT INTO Employee_Status ( [Employee Name], [Employee ID] )
> SELECT [Employee List].[Employee Name], [Employee List].[Employee ID]
> FROM [Employee List]
> WHERE ((([Employee List].[Employee ID]) <> [Employee_Status].[Employee
> ID]));
>
> I have no control over a linked table [Employee List] coming from
> managment
> dept. I want to query to insert all employees and ids to another table
> called
> Employee_Status (this table I will be able to create new columns such as
> status on them) . That way, I can update either active/not active and
> create
> reports/sign in sheets based on active employees only. I don't want to
> delete
> non active employees. I know this sounds very spagetti. Will you please
> tell
> how I can populate the table Employee_Status with the linked table
> Employee
> List?
Since you're not talking about a particular row in Employee_Status, the
WHERE clause isn't going to work properly. Possibly
WHERE [Employee List].[Employee ID] NOT IN (SELECT EmployeeID FROM
EmployeeStatus);
would work. Note I changed your field names in the table you DO control to
make them easier to work with.
HTH;
Amy
|
|
0
|
|
|
|
Reply
|
Amy
|
11/29/2007 6:01:12 PM
|
|
On Thu, 29 Nov 2007 17:09:45 GMT, "Mitchell_Collen via AccessMonster.com"
<u33726@uwe> wrote:
>I have no control over a linked table [Employee List] coming from managment
>dept. I want to query to insert all employees and ids to another table called
>Employee_Status (this table I will be able to create new columns such as
>status on them) . That way, I can update either active/not active and create
>reports/sign in sheets based on active employees only. I don't want to delete
>non active employees. I know this sounds very spagetti. Will you please tell
>how I can populate the table Employee_Status with the linked table Employee
>List?
I'd suggest a "frustrated outer join" query. Amy's NOT IN query is another way
to do it, but Access can be very inefficient at processing such queries - this
alternative gets to the same result but may be much faster:
INSERT INTO Employee_Status ( [Employee Name], [Employee ID] )
SELECT [Employee List].[Employee Name], [Employee List].[Employee ID]
FROM [Employee List] LEFT JOIN [Employee_Status]
ON [Employee List].[Employee ID]=[Employee_Status].[Employee ID]
WHERE [Employee_Status].[Employee ID] IS NULL;
John W. Vinson [MVP]
|
|
0
|
|
|
|
Reply
|
John
|
11/29/2007 6:55:20 PM
|
|
Thanks Amy.
-Misty
Amy Blankenship wrote:
>> INSERT INTO Employee_Status ( [Employee Name], [Employee ID] )
>> SELECT [Employee List].[Employee Name], [Employee List].[Employee ID]
>[quoted text clipped - 16 lines]
>> Employee
>> List?
>
>Since you're not talking about a particular row in Employee_Status, the
>WHERE clause isn't going to work properly. Possibly
>
>WHERE [Employee List].[Employee ID] NOT IN (SELECT EmployeeID FROM
>EmployeeStatus);
>
>would work. Note I changed your field names in the table you DO control to
>make them easier to work with.
>
>HTH;
>
>Amy
--
Message posted via http://www.accessmonster.com
|
|
0
|
|
|
|
Reply
|
Mitchell_Collen
|
11/29/2007 10:05:08 PM
|
|
Thanks John.
-Misty
John W. Vinson wrote:
>>I have no control over a linked table [Employee List] coming from managment
>>dept. I want to query to insert all employees and ids to another table called
>[quoted text clipped - 4 lines]
>>how I can populate the table Employee_Status with the linked table Employee
>>List?
>
>I'd suggest a "frustrated outer join" query. Amy's NOT IN query is another way
>to do it, but Access can be very inefficient at processing such queries - this
>alternative gets to the same result but may be much faster:
>
>INSERT INTO Employee_Status ( [Employee Name], [Employee ID] )
>SELECT [Employee List].[Employee Name], [Employee List].[Employee ID]
>FROM [Employee List] LEFT JOIN [Employee_Status]
>ON [Employee List].[Employee ID]=[Employee_Status].[Employee ID]
>WHERE [Employee_Status].[Employee ID] IS NULL;
>
> John W. Vinson [MVP]
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200711/1
|
|
0
|
|
|
|
Reply
|
Mitchell_Collen
|
11/29/2007 10:05:49 PM
|
|
|
4 Replies
159 Views
(page loaded in 0.212 seconds)
Similiar Articles: Append record to another table - microsoft.public.access.forms ...... the archive table. >>>> If I am going about this the wrong way please help me ... Microsoft Access Append Query Examples and SQL INSERT Query Syntax The tables that contain ... insert a blank row - microsoft.public.access.queriesIt is possible to run a query to inser a blan row in my table? If yes, can you please let me know how can I riight SQL? Your help is great appreciated... Inserting a sql string into a table using sql. Help please ...Help please ... append query with visual basic - microsoft.public.access.queries ... ... I tried as below but getting error message. please help me, how to insert the string ... Insert Multiple Records into a Table - microsoft.public.access ...... Table1 (F1, F2, F3, F4) VALUES ( 'CCP', 0.0115, 0.008202, 120) Is there an alternate way to insert multiple records in MS Access Table using a query. Please help. Insert ascii into Access - microsoft.public.access.queries ...... FileName#csv]' Can anybody help me with the ... Email address is not valid. > Please reply to ... into Access - microsoft.public.access.queries ... Hi I'm trying to insert ... insert into and repeating values - microsoft.public.access.queries ...I created a report based on a query. After fooling ... Page header in subreport does'nt repeat. Hi, I ... ... Help please ... insert into and repeating values ... Insert Table in Report - microsoft.public.access.reports ...... very dumb question, but is there a way to insert a ... or tables*) of data, and if you create a query that ... Microsoft Access MVP If I have helped you, please help me by ... INSERT INTO Query Converted to VBA - microsoft.public.access ...... http://I.Am/DougSteele (no private e-mails, please ... HELP! Thanks again, C Douglas J. Steele wrote ... INSERT INTO Query Converted to VBA - microsoft.public.access ... I have an append query that I want to run several times ...I used the RunMacro command but the exprression is not correct; please help me ... INSERT INTO Query Converted to VBA - microsoft.public.access ... Hello all, I have a ... INSERT INTO Via Cross Tab - microsoft.public.access.queries ...Can someone please tell how can I use INSERT INTO and pivot in the same query. ... Hoping it may help Vanderghast, Access MVP "AVNN ... INSERT query - please help me.INSERT INTO Employee_Status ( [Employee Name], [Employee ID] ) SELECT [Employee List].[Employee Name], [Employee List].[Employee ID] FROM [Employee List] mysql - hibernate native query insert wont work for java util date ...hibernate native query insert wont work for java util date, someone please help me, really desperate sql - please help me to create multi insert query - Stack OverflowI have got two table . create table t1(cid int, isnews int) create table t2(nid int,cid int, isnews int) situations is like this: if t2 contain t2.cid = t1.cid then ... query for insert only the current date not time. SQL ServerHi all query for insert only the current date not time. please help me thanks regards Shoaib Insert, Update and Delete. Can somebody please help me? - ASP.NETInsert, Update and Delete. Can somebody please help me?. ASP.NET Forums on ... Insert Command Help...Please; Trigger on Insert made a strage information, Insert query firing ... 7/23/2012 1:29:23 PM
|