Hello I have a table called table_A, and it has several columns and looks like this
s_type should be same for same s_id and s_name, so for s_id:10 and s_name:testA,HTML Code:id s_id s_name s_type created_date 1 10 testA typeA 2009-01-01 2 10 testA typeA 2009-01-02 3 10 testA typeA 2009-01-03 4 10 testA typeA_1 2009-01-04 5 11 testB typeB 2009-01-05 6 11 testB typeB_1 2009-01-06 7 11 testB typeB_1 2009-01-07 8 12 testC typeC 2009-01-08 9 12 testC typeC 2009-01-09 10 12 testC typeC 2009-01-10 11 12 testC typeC 2009-01-11 : : : : : : : : : :
s_type should be one type,either typeA or typeA_1, but data in the table is not.
And I need to figure out what s_id and s_name have more than one set of s_type.
In the above example, I would like to have following results from a query
Maybe it's okay not to show count if it's hard to implement.HTML Code:s_id s_name s_type count 10 testA typeA 3 10 testA typeA_1 1 11 testB typeB 1 11 testB typeB_1 2
As you see, in the results, there should not have s_id:12 s_name:testC, because s_id:12 s_name:testC has one type of s_type which is typeC.
I've tried several sql, but no success.
Thanks for your help in advance.







Bookmarks