I need someone to write me a MYSQL query for my database to do the following functionality.
I am using MYSQL 4.1.22-standard
Say I have the following table with 4 fields(a1, b1, c1, d1) and 6 records;
a1 b1 c1 d1
1000 a d A
5000 b e A
3000 c e B
7000 a e A
5000 a f A
7000 b f B
I want a customisable query that can do something like
COUNT(d1) AS NumOccurrences
Where a1<6000 AND a1> 3000 AND b1=a AND c1!=f
ORDER BY d1 DESC
So that the end result is a count by unique instances of d1 but with queries that I can customise to my hearts content.