2
I have 2 database tables:
Servers
+----------+--------------+
| Field | Type |
+----------+--------------+
| id | int(11) |
| ip | varchar(255) |
| votes | int(11) |
| port | varchar(255) |
| hash | varchar(255) |
| created | datetime |
| modified | datetime |
+----------+--------------+
Stats
+------------+--------------+
| Field | Type |
+------------+--------------+
| id | int(11) |
| server_id | int(11) |
| type | varchar(255) |
| hostname | varchar(255) |
| gamemode | varchar(255) |
| language | varchar(255) |
| players | int(11) |
| slots | int(11) |
| version | varchar(255) |
| url | varchar(255) |
| date_check | datetime |
| created | datetime |
| modified | datetime |
+------------+--------------+
I’m having trouble making the following rule of selection:
Select the table data Servers and make a Join with the Stats using the Servers.id = Stats.server_id. But this John must only take the most recent data (only one) table Stats that has the type equal to online or offline.
How could the query used to make this rule?
You want what data from each table?
– Sorack
You have examples of data: how it is and how it would have to look?
– novic
What is the field that defines that the data is most recent?
– novic