Combine Two Different Columns into one column

Hi Guys,

 

I have twotables(Employee and Borrower). In Employee table have EMPID and Borrower table have BorrowerID. I want to comebine these two columns into one column as EMPID  in Employee table. Can  any one help?

Thanks

0
jayasree_tella
5/30/2008 12:38:10 PM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

6 Replies
754 Views

Similar Articles

[PageSpeed] 24

what is realtion between to tables ?

 

0
Kiran
5/30/2008 1:44:03 PM

Use

 

 Union

0
Kiran
5/30/2008 1:46:53 PM

Thanks for reply.

Acutally Employee table EMPID, NAME Columns. in this Employee table had 12000 rows. Borrower table has BorrowerID,BType etc.. .Here Employee ID and BorrowerID both are same. This table has 16000 rows. Now my what i want to do is Come EMPID and BorrowerID and display in Employee table. I can get all ID's and Names. Can you give example?

 

Thanks

0
jayasree_tella
5/30/2008 1:51:19 PM

I tried but i am not getting.

Select EMPID,Name from EMPLOYEE

UNION

Select BorrowerID from BORROWER

i tried like above.

0
jayasree_tella
5/30/2008 1:52:48 PM

You should look up UNION or UNION ALL from Books Online or do a search. You need to match all columns from two SELECTs by using UION (ALL).

Try this(change bName to your Borrower's name column):

Select EMPID,Name from EMPLOYEE

UNION

Select BorrowerID, bName from BORROWER


Limno

0
limno
5/30/2008 2:00:58 PM

 Hi,

Try is code .

Select EMPID as Column1,Name as Column2 from EMPLOYEE

UNION

Select BorrowerID as Column1, bName as Column2 from BORROWER

 

0
stephenraja
5/31/2008 10:49:10 AM
Reply:

Similar Artilces:

How to combine two columns into one in an sql
I have an stored procedure that returns 3 columns. Month, Date, and Total Number of Calls. Here is the stored Proc: SELECT DATEPART(mm, CALLSTARTTIME) ,  DATEPART(dd, CALLSTARTTIME), COUNT(*) FROM CALL_LOG_MASTER WHERE (COMMERCIALS = '1') AND (PINCODE IS NOT NULL) GROUP BY DATEPART(mm, CALLSTARTTIME), DATEPART(dd, CALLSTARTTIME) ORDER BY DATEPART(mm, CALLSTARTTIME), DATEPART(dd, CALLSTARTTIME) It returns a table: MONTH   DATE   TOTAL NUMBER OF CALLS=======   =====   ===========1      ...

SQL query to one column od database into two columns
Hi,I have a empskill Table which has 3 Columns (1) EmpID (2) SkillTypeID and (3) CourseID.Now  SkillTypeID column has data 1 or 2 .......in here 1 means Primary Skill and 2 means Secondary Skill. CourseID will reflect the ID's of subjects like c#,SQL,etc I need a Query which will count the number of primary skilled and number of secondary skilled persons based on subject and will display as followsCOURSE ID      SKILL TYPE  21                        222  &n...

combine two tables with different columns in sql sever
Hi, I have a requirement like.. One table has 12 columns for all month  with different year.  Lets say i need values from sep-2008 to Mar-2009. I need to select the values from sep-2008 to dec-2008 as a single table and jan-2009 to Mar-2009 values as a single table. Now i need to combine these two table as a single table. Please help how to combine two tables with different columns. Thanks, Prabha  The question is unclear (put samples of exact data structure, test data and desired output). I think you need to look at UNPIVOT operator in SQL Server 2005. Look at the H...

How to Combine two column in one table using SQL statement ?
Could you write the simple SQL statement from 'Combine two column in one table '? I try to use 'Union' which combine two column in two table . thx You can use the concatention operator (+): SELECT column1 + column2 AS myColumn FROM myTable TerriTerri MortonEngagement Manager, NeudesicHow to ask a question If the columns are numeric then "+" will sum the column values. If you do not desire this, you should use str() function Check the below statement, select ltrim(str(column1)) + ltrim(str(column2)) from mytable http://www.eral...

SQL: mutiple rows one column to multiple columns one row
In InfoMaker SQL can you take a table with multiple rows for the same key and take a column from the rows and create mutiple columns with one report line with the key(no duplicate keys) on a report? For example Table books (key) (book title) 123 misery 123 titanic 123 roots 456 war 456 1984 456 giant The report I need would look like this Key title1 title2 title 3 123 misery titanic roots 456 war 1984 giant Thanks in advance. -- Kaye Hendry HealthInsight email:kaye.hendry@healthinsight.org ...

Using the same DataGrid with two different DataTables and one column difference
I'd like to populate the same DataGrid from two different functions with one column difference. One of the DataTables that will be used has an extra column entitled description, where I'd use a template column or bound column. I know that if I try to do it now, I'll get the error "DataBinder.Eval: 'System.Data.DataRowView' does not contain a property with the name Description. I tried using a label in the template column and disabling in the OnItemDataBound event. This obviously does not work. Is there a common way of doing something like this without having to create a whole second DataGrid...

Grouping two columns into one column with GridView
I would like to modify the default output of a gridview to group two columns into one column. This is probably best explained by example. So, lets say there is a simple gridview with the output something like this:Name           Description                           Date------------------------------------------------------------------Foo            Some description of foo     &nb...

how to split the content of one column in the objectdatasource into two parts and let them display in two columns in the GridView?
i combine the title and the body of one article and store it in one column in the database,but i want to show the title and body seperately in the GridView,how should i achieve this goal?thank you so much for your advice!!! you can write the logic of splitting the column into two (title and body) in the query itself by which you are filling the datasource..Thanx, [KaushaL] || BloG || Profile || Microsoft MVP"I would love to change the world, but they won’t give me the source code"Don't forget to click "Mark as Answer" on the post that helped you.This credits that me...

two db table column, one datagrid column
Dear all, I have a db table which have two column, first name and last name. Can I show them in one datagrid column? Thanks Yes you may. Through the usage of the TemplateColumn, yes. An example of this: <code> <asp:DataGrid runat="server" ID="dgSomeGrid">     <Columns>         <asp:TemplateColumn>             <ItemTemplate>                 <%# DataBinder.Eval(Container.DataSource, "LastName") %&g...

Merge two text columns into one text column
Hi Everyone.. I would like to know what is the best way to merge two text column into one test column in the table. Thanks pbj ANY HELP PLS.. Are you using any front end application or unix or just the isql to merge two text datatype columns? If you are using any front end application then it should not be a problem to merge the two text datatype columns. ...

Combining two columns into one parameter
Hi everyone. I have a query where I would like to search between a specific date range. The quirk to this though is that I want use that same date range on two different columns (ie ***.CreatedOn AND ***. ContactOn). I tried the following and obviously it doesn't work: SELECT * FROM source tables WHERE (dbo.dateonly(***.CreatedOn OR ***.ContactOn)) BETWEEN dbo.dateonly(@StartDate) AND dbo.dateonly(@EndDate) Any insight would be GREAT. Thank you!  Try this if either condition is met by using OR, otherwise use AND to meet both conditions. ....  WHERE Created...

When is a column not a column?
I have several extremely similar datawindows that I have to maintain that go against the same table. Recently, I had to add a column to that table, and also add the column to ALL of these datawindows that go against this table. I added the column to the first datawindow, set up the edit control style, etc. I then did a copy/paste of the columns edit control to the remaining dw's (of course remembering to first add the column in SQL). Everything (update props, column specs, column props) seems to indicate that the pasted column is linked to the column I selected, HOWEVER, when I...

Display multiple columns in Gridview from One Column of SQL table
Hi I have a table in sql with 2 columns and I want to display that in multiple columns in Gridview. SQL Table No.            Type 1               A1 1               B2 2              A2 2               B2 3        &...

[*-)]how to delete all columns except one column for the corresponding column name......?
hi friends,          i've a table with (columns) username, content,data,........... i need to delete all column names(i.e.,content,data,........) except username for the specified username. eg: consider username=mahendran. i've to delete the values in the content,data,...............for the username=mahendran. but username should exist.how to do that?pls help me......  ---------------------------------------------------Don't forget to "Mark as Answer" if you are satisfied. Use the following  DataTable.Columns.Rem...

Web resources about - Combine Two Different Columns into one column - asp.net.sql-datasource

Google Play Movies & TV now supports Apple TV, cellular streaming
Just because it isn't its native platform doesn't mean Google is giving iOS users the short end of the figurative stick when it comes to accessing ...

As Trump rises, Clinton preaches love and kindness
URBANDALE, Iowa (AP) — Hillary Clinton had just finished detailing the dangers of terrorism, recalling tough calls in the White House situation ...

Verizon Rolls Out Star Wars-Themed Droids in Time for The Force Awakens
With The Force Awakens hitting theaters — next week?! Time flies. Verizon and Motorola are getting in on the action. How could they not? When ...

Things to Know About Family of San Bernardino Shooters
Things to know about family members of the couple suspected in San Bernardino massacre

‘Serial’ Season 2 Opens With Bowe Bergdahl Channeling Jason Bourne – Sort Of
The second season of Serial is off to an auspicious start. The only podcast to win a Peabody Award scored the first interview with former Army ...

Connecticut to ban gun sales to those on terrorism no-fly list
Connecticut Gov. Dannel P. Malloy said on Thursday that he would sign an executive order to ban gun sales to those on federal terrorism no-fly ...

Experience 360-degree photos in virtual reality with Flickr's new app
We're constantly interacting with photos on our screens. We scroll, we tap, we pinch and drag to zoom. But what if you could virtually transport ...

Oklahoma City Cop Daniel Holtzclaw Found Guilty of Rapes
NBCNews.com Oklahoma City Cop Daniel Holtzclaw Found Guilty of Rapes NBCNews.com A former Oklahoma City police officer accused of raping more ...

Twitter's latest test: Showing you ads even if you're not logged in
The social network is trying to reach the 500 million people a month who visit the site without signing in. The hope? Make more money.

Watch Michelle Obama Perform In A Rap Video About Going To College For ‘College Humor’
Michelle Obama dropped some inspirational rhymes in a rap music video Thursday in an effort to raise awareness about the importance of a college ...

Resources last updated: 12/11/2015 9:51:50 AM