Query Two Tables with the same Field name

I have a query with two tables, both tables have one field that has the same field name which is "TYPE". One table has "Full-time" and the other table has "Part-time". Both tables also have a field "Name Employee".

How do I define this in the query so that it looks at "Name Employee" and then based on the employee will show one column with either Full-time or Part-time.

Currently I have three columns, Name Employee, TYPE-Full-time & TYPE-Part-time.

I want only two columns, Name Employee & TYPE and in the single TYPE column it will either have Full-time or Part-time
CMILLERAsked:
Who is Participating?
 
hnasrCommented:
als315!,

Thanks , typo.

CMILLER,

Did you use your table names?

SELECT yourTable1.* FROM yourTable1
UNION ALL
SELECT yourTable2.* FROM yourTable2;
0
 
als315Commented:
Do you have separate table with a list of all employees?
It will be better to have only one table, but in your case you can use union query.
0
 
peter57rCommented:
(No points)
What als315 is saying is to use ...

Select [Name employee], "Full-Time" as Type from fulltimetablename
union all
Select [Name employee], "Part-Time" as Type from parttimetablename
Order by [Name employee]
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
CMILLERAuthor Commented:
I am not sure yet if I can combine some tables. Long story short is I am a 17 yr Sys Admin but I am new to databases. I have inherited a large Access 2007 DB and still figuring my way around it. I am looking to get it migrated into our Ent SQL but that my take some time.

peter57r: I will try that today to see if that works.

-Thanks
0
 
hnasrCommented:
First comment is fine giving the main idea, second is a clarification and this one is a simplification.

SELECT tble1.* FROM tbl1
UNION ALL
SELECT tble2.* FROM tbl2;
0
 
CMILLERAuthor Commented:
hnasr,

I am getting this error.

Syntax error in FROM clause. (Error 3131)
0
 
CMILLERAuthor Commented:
peter57r,

I am getting this error.

Syntax error in FROM clause
0
 
als315Commented:
You should have same table name. Now you have tble1.* and From tbl1.
If tables are tbl1 and tbl2, syntax will be:
SELECT tbl1.* FROM tbl1
UNION ALL
SELECT tbl2.* FROM tbl2;
But you should also ad¿ column with type if it is missing in your tables.
0
 
CMILLERAuthor Commented:
Got it working Thanks to Both of you!
0
 
hnasrCommented:
Welcome!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.