Hi, I need to write a query and I'm not even sure where to begin on this one. I have a set of tables that I did not create and cannot change.
member table
+----+-------+
| id | class |
+----+-------+
| 1 | 1 |
| 2 | 2 |
+----+-------+
member_data table
+----+------------+-----------+
| id | first_name | last_name |
+----+------------+-----------+
| 1 | John | Jones |
| 2 | Juan | Jones |
+----+------------+-----------+
member_entries table
+----+-----------+-------+------------+
| id | member_id | title | date |
+----+-----------+-------+------------+
| 1 | 1 | test1 | 1265042580 |
| 2 | 1 | test2 | 1265042581 |
| 3 | 2 | test3 | 1265042582 |
| 4 | 3 | test4 | 1265042583 |
+----+-----------+-------+------------+
I need to select id, first_name from member_data, the most recent title from member_entries, and the total count of member_entries that matches the member_id. I need to be able to select where a member's class is a certain number in the first table. I also need to be able to order by any of those columns. This is what I need my output to be, if I selected members where member class is 1.
+----+------------+-------+------------+
| id | first_name | title | date |
+----+------------+-------+------------+
| 1 | John | test2 | 1265042581 |
+----+------------+-------+------------+