Ok, so here is my question. Maybe my brain is just fried, but im struggling to wrap my head around this
i have one table(lets say TableA with a set of columns, lets say there names are:
pk1, Pk2, a, b, c,APPLE(has 3 set values from another table), etc (the PK1 and PK2 are primary keys)
and then I have another table(lets say tableB)
PK1(is linked with PK1 on TableA), ag, DOG, sf, STAR(also has a set nr of values),etc
Ok, so now i want to join these 2 tables, thats the easy part. the values in PK1 can repeat, as long as the combination of PK1 and PK2 are unique,and this is the case.
ok, here comes the tricky part. i want get a list of of the distinct combinations of PK1+PK2+a
but i also want to know how many of them are of each type of STAR.
ok, this part is optional(for you bright sparks out there):
and just to really make it tricky, each type of star must then be sub divided into types of APPLES
1) how do i do this?
2) is it possible to do it with just 1 query, i will i have to use something like a cursor?
What have you tried? Maybe this can help?
,
,