Reputation: 532
I have the flowing tables:
See fiddle: http://sqlfiddle.com/#!2/c1c2f/1
I'm struggling to find a way to
select software.name, systems.pc(or software.pc), systems.user
only for the rows were the software.date field matches the systems.time field meaning that fields
Upvotes: 0
Views: 78
Reputation: 16524
You need a JOIN, like this:
SELECT software.name, software.pc, systems.pc, systems.user
FROM software
JOIN systems
ON software.date = systems.time AND software.pc = systems.pc;
Fiddle: http://sqlfiddle.com/#!2/c1c2f/34/0
Upvotes: 2
Reputation: 4730
It is better to use aliases when querying complex data with JOINs, see following:
SELECT so.name, sy.pc, sy.user FROM software so
JOIN systems sy
WHERE so.date = sy.time AND so.pc = sy.pc;
Specially, when you have same named columns. As in your case both tables have same column (PC).
Upvotes: 1