December 7, 2011 at 11:49 am
Hello,
I have a column patID with some values( with some condition 1), patID with some columns(with some condition 2).How can I merge all the values into a single patID column? My query is like this:
select patID from table1 where isnumeric(patID)=o
select patID from table1 where isnumeric(patID)=1
I want a single patID column by joining these two select statements.
December 7, 2011 at 11:55 am
Please post a script to create the table, some test data and the expected results. I can't figure out what you want based on what you posted.
Todd Fifield
December 7, 2011 at 1:23 pm
ramanamreddy (12/7/2011)
Hello,I have a column patID with some values( with some condition 1), patID with some columns(with some condition 2).How can I merge all the values into a single patID column? My query is like this:
select patID from table1 where isnumeric(patID)=o
select patID from table1 where isnumeric(patID)=1
I want a single patID column by joining these two select statements.
select patID from table1 where isnumeric(patID) in (1,0)
______________________________________________________________________________
How I want a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.
December 7, 2011 at 2:14 pm
toddasd (12/7/2011)
ramanamreddy (12/7/2011)
Hello,I have a column patID with some values( with some condition 1), patID with some columns(with some condition 2).How can I merge all the values into a single patID column? My query is like this:
select patID from table1 where isnumeric(patID)=o
select patID from table1 where isnumeric(patID)=1
I want a single patID column by joining these two select statements.
select patID from table1 where isnumeric(patID) in (1,0)
Or the even simpler version...
select patID from table1
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
December 7, 2011 at 3:27 pm
ramanamreddy (12/7/2011)
Hello,I have a column patID with some values( with some condition 1), patID with some columns(with some condition 2).How can I merge all the values into a single patID column? My query is like this:
select patID from table1 where isnumeric(patID)=o
select patID from table1 where isnumeric(patID)=1
I want a single patID column by joining these two select statements.
You do understand that by asking ISNUMERIC you will only get 0 or 1? Therefore, the 2 statements you are using are not needed; i.e. together they return ALL results from the table. It is like saying "all of the people who agree with me, come with me. all of the people who disagree with me, come with me." Nobody is left behind!
Jared
Jared
CE - Microsoft
December 7, 2011 at 3:39 pm
Sean Lange (12/7/2011)
toddasd (12/7/2011)
ramanamreddy (12/7/2011)
Hello,I have a column patID with some values( with some condition 1), patID with some columns(with some condition 2).How can I merge all the values into a single patID column? My query is like this:
select patID from table1 where isnumeric(patID)=o
select patID from table1 where isnumeric(patID)=1
I want a single patID column by joining these two select statements.
select patID from table1 where isnumeric(patID) in (1,0)
Or the even simpler version...
select patID from table1
/smackshead :pinch:
I couldn't see past
select patID from table1 where patID in (1,0)
______________________________________________________________________________
How I want a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply