Author |
Topic |
vinay789
Starting Member
40 Posts |
Posted - 2009-05-06 : 07:43:16
|
Hi to everyonei am a newbie to mssql my problem is in my db i have 2 queries like thisselect t1,t2,t3 from T1 and another query select s1,s2,s3 from S1 now i want to add s1 field to T1 any suggestions pls Edit/Delete Message |
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-05-06 : 07:45:12
|
you are not clear. post sample data, table structure and output you need. |
 |
|
vinay789
Starting Member
40 Posts |
Posted - 2009-05-06 : 08:04:15
|
i want to join field s1 with T1 i used JOIN like thisselect t1,t2,t3,s1 from T1 JOIN S1 ON (T1.adid=S1.adid)but this code is not giving correct output in my JSP page any help |
 |
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-05-06 : 08:28:25
|
again,, "post sample data, table structure and output you need" |
 |
|
NeilG
Aged Yak Warrior
530 Posts |
Posted - 2009-05-06 : 08:36:49
|
Are you meaning that you want to join two tables together or two columns if it's the latter use the "+" to join them togther, otherwise it looks like you already able to join the tables from your post abovelikeselect T1ColumnName+s1ColumnName from T1 INNER JOIN S1 ON T1.adid=S1.adid |
 |
|
vinay789
Starting Member
40 Posts |
Posted - 2009-05-06 : 08:40:34
|
ok in my db i have two tables one is employee and other is staff For table employee eid,ename,esal are the field names For staff sno,sname,ssal are the field namesNow i want to combine the field name {sno} with employee table give me a select statement how to combine the both tables |
 |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-05-06 : 09:05:50
|
It is an awesome challenge to give sample data, table structure and needed output - isn't it? No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-05-06 : 09:12:36
|
[code]select eid,ename,esal from employeeunion allselect sno, sname, ssal from staff[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
vinay789
Starting Member
40 Posts |
Posted - 2009-05-06 : 09:22:40
|
Hikhtan thanx for ur response i want to add only sno to employee not all the fields |
 |
|
vinay789
Starting Member
40 Posts |
Posted - 2009-05-06 : 09:24:00
|
quote: Originally posted by khtan
select eid,ename,esal from employeeunion allselect sno, sname, ssal from staff KH[spoiler]Time is always against us[/spoiler]
Hikhtan thanx for ur response i want to add only sno to employee not all the fields |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-05-06 : 09:26:21
|
then can you kindly provide us the table DDL, sample data and HOW DO YOU WANT THE RESULT TO LOOKS LIKE.cause . . . all of us are just guessing . . nobody knows what you want KH[spoiler]Time is always against us[/spoiler] |
 |
|
vinay789
Starting Member
40 Posts |
Posted - 2009-05-06 : 09:34:19
|
quote: Originally posted by khtan then can you kindly provide us the table DDL, sample data and HOW DO YOU WANT THE RESULT TO LOOKS LIKE.cause . . . all of us are just guessing . . nobody knows what you want KH[spoiler]Time is always against us[/spoiler]
i used JOIN in select statement like thisselect eid,ename,esal,sno from employee JOIN staff ON employee.username=staff.username but this code is not working properly pls modify |
 |
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-05-06 : 09:38:34
|
Even after so many of us asking for sample data and expected output...y do you hesitate to provide them? We do not have access to your data. Please provide sample data and expected output to provide a working solution for you. |
 |
|
vinay789
Starting Member
40 Posts |
Posted - 2009-05-06 : 10:11:45
|
I need to pull data from 2 or more sources (tables or views) and combined them into 1 logical unit. This is my code i used JOIN in select statement like thisselect eid,ename,esal,sno from employee JOIN staff ON employee.username=staff.usernamebut this code is not working properly pls modify |
 |
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2009-05-06 : 11:14:34
|
Try following the first link in my signature, then restate your question with all of the DML and DDL that has been requested.[Signature]For fast help, follow this link:http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspxLearn SQL or How to sell Used CarsFor ultra basic questions, follow these links.http://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
mailsomani
Starting Member
4 Posts |
Posted - 2009-05-07 : 08:50:22
|
Hi,If you provide some sample data and how you want optput then somebody can help you.Try to create some sample data and give the output how you want, based on that possibly we can provide query for that.ReagrdsPawan SomaniWINWIRE TECHNOLOGIESPawansomani |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-05-07 : 09:09:26
|
quote: Originally posted by vinay789 ok in my db i have two tables one is employee and other is staff For table employee eid,ename,esal are the field names For staff sno,sname,ssal are the field namesNow i want to combine the field name {sno} with employee table give me a select statement how to combine the both tables
Do you mean this?select sno+'-'+eid as eid,ename,esal from employee JOIN staff ON employee.username=staff.username MadhivananFailing to plan is Planning to fail |
 |
|
|