September 13, 2012 at 1:20 pm
I have a table xtr
OURIDFACLITY
1A
1b
2C
3D
3b
3A
2A
4B
5B
I want output like
OURIDFACLITY
1 A
1 b
3 b
3 A
Please help
September 13, 2012 at 1:24 pm
Can you explain how you get to that output? I am not seeing a pattern there.
September 13, 2012 at 1:24 pm
Sharon Kumar (9/13/2012)
I have a table xtrOURIDFACLITY
1A
1b
2C
3D
3b
3A
2A
4B
5B
I want output like
OURIDFACLITY
1 A
1 b
3 b
3 A
Please help
What is the question?
_______________________________________________________________
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/
September 13, 2012 at 1:32 pm
In this Ourid is having int values and Faclity having char values
I want output where faclity is a and b having same our id column value
eg: a=2
b=2
Sorry For my English.
September 13, 2012 at 1:46 pm
Sharon Kumar (9/13/2012)
In this Ourid is having int values and Faclity having char valuesI want output where faclity is a and b having same our id column value
eg: a=2
b=2
Sorry For my English.
Can you take a look at the first link in my signature about best practices when posting questions? There is nowhere near enough details to provide anything other than a shot in the dark. We need ddl (create tables scripts) sample data (insert statements) and desired output based on your sample data. A clear explanation of how the business rules would help quite a bit too.
_______________________________________________________________
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/
September 15, 2012 at 10:08 am
really not sure if this is what you are after...but try it as a start and then we maybe improve
;with CTE as
(
SELECT OURID
FROM XTR
WHERE FACILITY IN( 'A' , 'B' )
GROUP BY OURID
HAVING COUNT( OURID ) > 1
)
SELECT cte.OURID ,
XTR.FACILITY
FROM cte INNER JOIN XTR ON cte.OURID = XTR.OURID
WHERE XTR.FACILITY IN( 'A' , 'B' );
________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply