1752756 Members
4892 Online
108789 Solutions
New Discussion юеВ

Re: Sql Query

 
Tapas Jha
Valued Contributor

Re: Sql Query

Sanjay,

Sorry But I didn't get you. Can you explain by column1 and column2. Here in my case what will be column1 and column2. Since tstwght is the filed which will be different for the same tstAB.
Below is the output from where you can say.( for the same tstAB there are diff tstwght. We need those)
tstkey 45482954
tstAB 4839530267
tstacct 121235539
tstwght 0.5

tstkey 45488682
tstAB 4839530267
tstacct 121235539
tstwght 1.0

Rgds
Tapas
Tapas Jha
Brian Crabtree
Honored Contributor

Re: Sql Query

select tstab, tstwght from tableA where tstab in (select tstab from tableA group by tstab having count(*) > 1);

That should work. Let me know.

Thanks,

Brian
Tapas Jha
Valued Contributor

Re: Sql Query

Hi Brian,

Thanx for your reply. Your query results like below:

tstab tstwght
15581882 2.0
15581882 2.0
206367781 0.5
206367781 0.5
308102874 0.5
308102874 10.5
336157080 0.5
336157080 0.5
339287550 0.5
339287550 1.0
339582261 4.5
339582261 0.5
But i want those which have different tstwght. My expected output will be like:
tstab tstwght
308102874 0.5
308102874 10.5
339287550 0.5
339287550 1.0
339582261 4.5
339582261 0.5

Hope it is clear to you.
Rgds
Tapa
Tapas Jha
Fred Ruffet
Honored Contributor

Re: Sql Query

Maybe you should add tstwght to the group by clause.

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)