[odb-users] Defining a table view with inner join
Boris Kolpackov
boris at codesynthesis.com
Fri Jan 19 07:26:52 EST 2018
Lior Tamim <liorta at gmail.com> writes:
> Suppose I have 2 database tables:
>
> CREATE TABLE developers(
> employee_id INTEGER,
> employee_name TEXT)
>
> CREATE TABLE new_employees(
> id INTEGER,
> age INTEGER)
>
> I wish to define a table view that contains all the *new developers*.
>
> With simple SQL query this can be achieved easily by using inner join:
> "select * from developers inner join new_employees on
> developers.employee_id == new_employees.id"
>
> What's the best way to achieve this with table view pragma?
>
> #pragma db view table("developers" ...) // not sure how to continue this
Section 10.3, "Table Views" in the manual deals with this pretty
comprehensively, including an example that does pretty much
exactly this (sans the inner join, but it should be fairly
clear where to put it from the general format discussed a
couple of paragraphs above).
More information about the odb-users
mailing list