How to get emp id, sal, date from 2 tables ?

Posted by Kk86kiran under Sql Server on 4/17/2012 | Points: 10 | Views : 761 | Status : [Member] | Replies : 3
Hi friends,

I have already asked this question for 1 table but this time i am asking for 2 tables Means i have 2 tables January & February with same column names those are empid,sal,date.

Now i want to show out put like this

[Empid] [No.ofEmpid] [TotalSal] [No.OfMonths]

1 2times 12000 2Months
2 2times 20000 2Months
3 2times 10000 2months

k.m.j.kiran


Responses

Posted by: Sakthi.Singaravel on: 4/17/2012 [Member] Silver | Points: 25

Up
0
Down
hi kiran,

use join query..

Regards,
Singaravel M

Kk86kiran, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 4/17/2012 [Member] Starter | Points: 25

Up
0
Down
Hi Kiran,
If u have common fields in both tables u can use join query.
http://www.w3schools.com/sql/sql_join.asp

Thanks & Regards
Hari

Thanks & Regards
Hari

Kk86kiran, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jasminej on: 4/18/2012 [Member] Starter | Points: 25

Up
0
Down
Can you give Table structure with data ?

Kk86kiran, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response