April 24, 2009 at 1:24 pm
Hello,
I am trying to create a view which gives records. Some of them have the same values over most of the fields. My goal is to group them by these fields. But, I cannot just group by these fields, I would have to group by all the fields in the "select" clause.
I know of a command called "Break on" in Oracle SQL-Plus. This creates a line break when it finds a unique record. So the repeating record gets listed only once. However, this command doesn't seem to be working for SQL Server. I want to know an equivalent of that so that I would have the repeating record listed just once.
Any help on this would be truely appreciated
Thanks
Shruti
April 24, 2009 at 1:26 pm
I don't believe there is such a function in T-SQL. But I'd also say that this kind of thing should be done in the presentation layer, not in the database. Should be very easy to do in your application, I would think.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
April 25, 2009 at 12:13 am
So the repeating record gets listed only once.
This sounds like a SELECT DISTINCT query. It returns only the unique combinations of all columns included in the SELECT list.
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
June 18, 2009 at 8:27 am
GSquared (4/24/2009)
I don't believe there is such a function in T-SQL. But I'd also say that this kind of thing should be done in the presentation layer, not in the database. Should be very easy to do in your application, I would think.
I understand this, but do you the following is possible in T-SQL?
Assume the format of the data is in the following:
A B C D
A B C D
A B C D
A B C D
Is there a way to render the output as the following?
A B D
C
A B D
C
A B D
C
A B D
C
Thanks for any help
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply