I've got two tables:
LOGGINGTYPES
id
name
LOGFILES
id
type_id (linked to loggintypes.id)
client_ip
time
logcontent
I am quite new to MYSQL, but I am looking for a query that only selects * from loggingtypes if there are logs linked to it.
With "SELECT * FROM loggingtypes ORDER BY name" I get everything, how do I get it to select only rows which have logs linked to it?
Is
SELECT
DISTINCT logging_types.id, loggingtypes.name
FROM logging, logging_types
WHERE logging.type_id = loggingtypes.id
the best way to go?