Showing posts with label cat1cat2cat3start. Show all posts
Showing posts with label cat1cat2cat3start. Show all posts

Thursday, March 22, 2012

Distinct Command ...

mytable

Cat1

Cat2

Cat3

Start price

End price

A

a

a

12

21

A

a

b

98

11

A

a

a

99

12

A

b

b

12

11

A

b

a

9

0

A

b

b

1

1

My result should be like this …..

( Result of SQL Query? )

Cat1

Cat2

Cat3

A

a

a

A

a

b

A

b

a

A

b

b

What is the sql command to do like this?

Maybe this will work for you?

create

table #test( cat1varchar(10),

cat2

varchar(10),

cat3

varchar(10),

StartPrice

int,

EndPrice

int)

insert

into #test

values

('A','a','a', 12,21)

insert

into #test

values

('A','a','b', 98,11)

insert

into #test

values

('A','a','a', 99,12)

insert

into #test

values

('A','b','b', 12,11)

insert

into #test

values

('A','b','a', 9,0)

select

*from #test

Select

Distinct cat1,cat2,cat3from #test

drop

table #test|||

You already have the answer... DISTINCT

Try:

SELECT DISTINCT Cat1, Cat2, Cat3 FROM mytable

|||

cloris:

You already have the answer... DISTINCT

Try:

SELECT DISTINCT Cat1, Cat2, Cat3 FROM mytable

Haha ha,, i am foolish ........

Thanks cloris

|||It's one of those things. The languages typically have an easy way of doing something if you know where to look. Good Luck.