A coworker asked for some sql assistance today. He needed to search on two separate text strings within the same field. The output fields had to be from two separate tables. I solved the problem by joining both tables on the id fields. Here's the query.
SELECT d.address, t.timestamp, t.log_message
FROM devices d, log_messages t
WHERE (t.log_message like '%Core not running%'
OR t.log_message like '%Exception !! Did not get Update%')
AND d.id = t.device_id
ORDER by d.mac_address asc
into outfile '/tmp/sql_2011jan24.txt';
No comments:
Post a Comment