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(*)
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
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.
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 (+):
column1 + column2 AS myColumn
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
(key) (book title)
The report I need would look like this
Key title1 title2 title 3
123 misery titanic roots
456 war 1984 giant
Thanks in advance.
...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
I have a db table which have two column, first name and last name.
Can I show them in one datagrid column?
Yes you may. Through the usage of the TemplateColumn, yes. An example of this:
<asp:DataGrid runat="server" ID="dgSomeGrid">
"LastName") %&g...Merge two text columns into one text column
I would like to know what is the best way to merge two text column into one
test column in the table.
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:
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.
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