SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL query
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

pari3006
Starting Member

1 Posts

Posted - 07/15/2013 :  10:25:16  Show Profile  Reply with Quote
I have a table of the following format

COl_A COL_B COL_C COL_D
A B C D
A B C D
A B1 C1 D1A
A B2 C2 D2
A B C1 D3
A1 B C1 D
A1 B1 C1 D1


i want result as
Col_A COl_B COl_C COL_D
A B C D
A B1 C1 D1A
A B2 C2 D2
A B C1 D3
A1 B C1 D
A1 B1 C1 D1

Please help

James K
Flowing Fount of Yak Knowledge

3712 Posts

Posted - 07/15/2013 :  11:27:09  Show Profile  Reply with Quote
quote:
Originally posted by pari3006

I have a table of the following format

COl_A  COL_B  COL_C  COL_D
A       B      C      D
A       B      C      D
A       B1     C1     D1A
A       B2     C2      D2
A       B      C1      D3
A1      B      C1      D
A1      B1     C1      D1


i want result as
Col_A  COl_B   COl_C   COL_D
A       B       C      D
A       B1     C1     D1A
A       B2     C2      D2
A       B      C1      D3
A1      B      C1      D
A1      B1     C1      D1


Please help


SELECT DISTINCT
   COL_A,COL_B,COL_C,COL_D
FROM
   YourTable


Or,even this:
SELECT
   COL_A,COL_B,COL_C,COL_D
FROM
   YourTable
GROUP BY
   COL_A,COL_B,COL_C,COL_D

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000