mirror of
https://github.com/standardebooks/web.git
synced 2025-07-18 04:16:38 -04:00
Rewrite MultiTableSelect
queries with ON
Instead of `USING(EbookId)`, it would be easier to handle `MultiTableSelect` queries in `FromMultiTableRow()` if the queries used `ON Projects.EbookId = Ebooks.Ebooks` This is because `USING` will return only one `EbookId` column, but `ON` will return all columns from both tables.
This commit is contained in:
parent
dad5df0059
commit
0e7bff5d82
3 changed files with 13 additions and 12 deletions
|
@ -164,8 +164,8 @@ final class Ebook{
|
|||
SELECT *
|
||||
from Projects
|
||||
inner join Ebooks
|
||||
using(EbookId)
|
||||
where EbookId = ?
|
||||
on Projects.EbookId = Ebooks.EbookId
|
||||
where Ebooks.EbookId = ?
|
||||
order by Projects.Created desc
|
||||
', [$this->EbookId], Project::class);
|
||||
}
|
||||
|
@ -183,8 +183,8 @@ final class Ebook{
|
|||
SELECT *
|
||||
from Projects
|
||||
inner join Ebooks
|
||||
using(EbookId)
|
||||
where EbookId = ?
|
||||
on Projects.EbookId = Ebooks.EbookId
|
||||
where Ebooks.EbookId = ?
|
||||
and Status in (?, ?)
|
||||
', [$this->EbookId, Enums\ProjectStatusType::InProgress, Enums\ProjectStatusType::Stalled], Project::class)[0] ?? null;
|
||||
}
|
||||
|
@ -206,8 +206,8 @@ final class Ebook{
|
|||
SELECT *
|
||||
from Projects
|
||||
inner join Ebooks
|
||||
using(EbookId)
|
||||
where EbookId = ?
|
||||
on Projects.EbookId = Ebooks.EbookId
|
||||
where Ebooks.EbookId = ?
|
||||
and Status in (?, ?)
|
||||
', [$this->EbookId, Enums\ProjectStatusType::Completed, Enums\ProjectStatusType::Abandoned], Project::class);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue