Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2005
»
T-SQL (SS2K5)
»
distinct columns
distinct columns
Rate Topic
Display Mode
Topic Options
Author
Message
scottichrosaviakosmos
scottichrosaviakosmos
Posted Saturday, July 17, 2010 12:01 AM
SSC Journeyman
Group: General Forum Members
Last Login: Sunday, February 24, 2013 12:46 AM
Points: 97,
Visits: 429
i have a table with no unique fields but and when i use distinct for column1 then it gives 3000 rows or values but when i use distinct for all the fields then it gives 7000 rows. I want all rows related to the column one ie. i want to get distict all rows on basis of coloumn1 ie 3000 rows of all fields.
currently i m useing query :
select distinct * from table1 where column1 in (select distinct column1 from table 1).
but this is giving 7000 rows but dustinct column1 is only 3000 rows.
Post #954310
LutzM
LutzM
Posted Saturday, July 17, 2010 2:34 AM
SSCertifiable
Group: General Forum Members
Last Login: Wednesday, April 24, 2013 3:17 PM
Points: 6,731,
Visits: 12,131
It's not clear to me what you're looking for.
What rows do you want to return?
Simple scenario:
col1 col2
A1 1
A1 2
A2 3
A2 4
What would be your expected output?
Lutz
A pessimist is an optimist with experience.
How to get fast answers to your question
How to post performance related questions
Links for
Tally Table
,
Cross Tabs
and
Dynamic Cross Tabs
,
Delimited Split Function
Post #954326
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.