I'm trying to write a script that counts results based on 2 fields matching - but not matching like identically, but where the values re-occur throughout the table.
For example, I want to find where Field A and Field B = x & y, respectively (and count those results) however, field A isn't always X and field B isn't always Y. Also, Field A and Field B values are unknown. Here's what I've written so far:
select a.fielda, b.fieldb, count (*)
from tableA a
join tableB b
on a.fieldd = b.fieldd
where a.fielda = b.fieldb --I know this is a problem, just for notes on what I'm trying to accomplish.
group by b.fieldb, a.fielda
order by b.fieldb.
I'm a newb here so any help will be greatly appreciated. Thank you in advance.