Use WHERE clause on a column from another table

Vortico

I have this schema.

create table "user" (id serial primary key, name text unique);
create table document (owner integer references "user", ...);

I want to select all the documents owned by the user named "vortico". Can I do it in one query? The following doesn't seem to work.

select * from document where owner.name = 'vortico';
stan
SELECT * FROM document d INNER JOIN "user" u ON d.owner = u.name 
WHERE u.name = 'vortico'

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Can i use a "virtual column" in Where clause?

From Dev

Use comma separated list from one table as clause in query for another table

From Dev

Use a calculated column in a where clause

From Dev

SQL code for updating a column where the WHERE condition is from another table

From Dev

Select from table where column in select from another table in laravel

From Dev

delete row from table where column does not exist in another table

From Dev

Laravel 5 where clause from another table

From Dev

How to use json column in the WHERE clause as a condition

From Dev

Use OR conditions in WHERE clause as column names in result

From Dev

MySQL WHERE clause link to another table

From Dev

Using date from one table in a where clause with a column in a different table

From Dev

Use clause WHERE on calculated column (including subquery)

From Dev

use nested table value in where clause(oracle)

From Dev

use variable as column name in where clause in sql

From Dev

SQL code for updating a column where the WHERE condition is from another table

From Dev

How can I use a where clause and check if a string variable contains in a many table column

From Dev

Select from table where column in select from another table in laravel

From Dev

where clause based on a select statement from another table

From Dev

Use where clause in temporary table

From Dev

WHERE clause from another table using NOT IN

From Dev

Using column values from one table within a select clause from another table

From Dev

Use returned value from query in the a where clause for another select query

From Dev

Sequentially use values from a column in a where clause

From Dev

SQL INSERT from where clause to another where clause

From Dev

How to use an alias of table declared in 'FROM' in 'WHERE' clause?

From Dev

Transferring data from one table to another using a where clause mysql

From Dev

SQL LEFT JOIN with where clause from another column

From Dev

MySQL - Selecting data from another table for a WHERE clause

From Dev

Using column data from another table for the where clause of two joined tables

Related Related

  1. 1

    Can i use a "virtual column" in Where clause?

  2. 2

    Use comma separated list from one table as clause in query for another table

  3. 3

    Use a calculated column in a where clause

  4. 4

    SQL code for updating a column where the WHERE condition is from another table

  5. 5

    Select from table where column in select from another table in laravel

  6. 6

    delete row from table where column does not exist in another table

  7. 7

    Laravel 5 where clause from another table

  8. 8

    How to use json column in the WHERE clause as a condition

  9. 9

    Use OR conditions in WHERE clause as column names in result

  10. 10

    MySQL WHERE clause link to another table

  11. 11

    Using date from one table in a where clause with a column in a different table

  12. 12

    Use clause WHERE on calculated column (including subquery)

  13. 13

    use nested table value in where clause(oracle)

  14. 14

    use variable as column name in where clause in sql

  15. 15

    SQL code for updating a column where the WHERE condition is from another table

  16. 16

    How can I use a where clause and check if a string variable contains in a many table column

  17. 17

    Select from table where column in select from another table in laravel

  18. 18

    where clause based on a select statement from another table

  19. 19

    Use where clause in temporary table

  20. 20

    WHERE clause from another table using NOT IN

  21. 21

    Using column values from one table within a select clause from another table

  22. 22

    Use returned value from query in the a where clause for another select query

  23. 23

    Sequentially use values from a column in a where clause

  24. 24

    SQL INSERT from where clause to another where clause

  25. 25

    How to use an alias of table declared in 'FROM' in 'WHERE' clause?

  26. 26

    Transferring data from one table to another using a where clause mysql

  27. 27

    SQL LEFT JOIN with where clause from another column

  28. 28

    MySQL - Selecting data from another table for a WHERE clause

  29. 29

    Using column data from another table for the where clause of two joined tables

HotTag

Archive