Skip Menu |

This queue is for tickets about the DBIx-Class CPAN distribution.

Report information
The Basics
Id: 133253
Status: new
Priority: 0/
Queue: DBIx-Class

Owner: Nobody in particular
Requestors: robert [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Subject: DBix::Class How do I...?
Date: Mon, 31 Aug 2020 16:24:19 +0100
To: bug-DBIx-Class [...]
From: Robert Inder <robert [...]>
Download (untitled) / with headers
text/plain 1.5k
I'm working on an existing, fairly complex database. Within which there is * a table of Jobs, some of which have an external_id. * a table of Report elements which have the relevant external_id. I want to find all the jobs with external_id which have been resolved since they were last reported. But I can't see how to do this. I'd like to end up with SQL something like the following: SELECT (lots of stuff) FROM job WHERE .... <<Conditions>> AND NOT EXISTS (SELECT id FROM report WHERE report.external_id = job.external_id AND report.created > job.resolved_time); But note that external_id fields are just strings: there is no constraint between the two tables. And the sub-query refers to job.resolved_time from the main query. I've tripped over the mention of `-not_exists` in the documentation of `alias` for a ResultSet, so I think it can probably be done. BUT I'm really struggling to map that partial example to my situation -- for instance, what has to be in $rs and $self? Pointers? To a self-contained example?? Robert. P.S. I realise this is not actually a bug, but the README for DBIx::Class on CPAN says If you are stuck with a problem or have doubts about a particular approach do not hesitate to contact us So... -- Robert Inder, 0131 229 1052 / 07808 492 213 Interactive Information Ltd, 3, Lauriston Gardens, Edinburgh EH3 9HH Registered in Scotland, Company no. SC 150689 Interactions speak louder than words

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to