December 10, 2013 at 12:10 am
I Have table like this......
House_no
6-1
6-1-2
6-1/2
6-1/78
6-12/5
6-3-124 ,hyderabad
6-3/2
6-3-19876 ,yuyu
select only first '-' only.............
I WANT OUTPUT LIKE THIS order ...........
6-1
6-1/2
6-1/78
6-3/2
6-12/5
December 10, 2013 at 12:15 am
SELECT House_no
FROM myTable
WHERE CHARINDEX('-',House_no,CHARINDEX('-',House_no,1)+1) = 0
ORDER BY House_no
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
December 15, 2013 at 11:07 am
Each one of your five current threads
select quarie between houseno ..........
select only up to first '-' only
display order by like 1,2,3,4,5...............plz write quarie
relate to the same issue. Help us and you will help yourself. Please provide a sample data set which is properly representative of your data. Your data doesn't all look like "3-9-55". If it did, any one of several solutions already posted would work just fine.
Is "3-9-55" just a Hyderabad house number or is it three data elements combined into one?
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply