Selecting two rows from another table using one row

Calibur Victorious

table1

[      id      -      title      -      content      -      class      ]
[      1       -        2        -         3         -        1        ]
[      1       -        2        -         3         -        2        ]

table2

[      id      -       data      -    permission     -      class      ]
[      a       -        b        -         c         -        1        ]
[      a       -        b        -         c         -        2        ]

How can i select the column data from table2 while selecting all table1

my query is SELECT title, content FROM table1 WHERE class = 1

How can i select column data and permission in this query?

Siyual

You can do this with a simple JOIN:

Select  T1.*, T2.Data, T2.Permission
From    Table1  T1
Join    Table2  T2  On  T1.Class = T2.Class
Where   T1.Class = 1

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Taking ids from two rows of one MySQL table and entering those values in one row of another MySQL table using PHP

From Dev

selecting unique rows from one table according to another table and then sorting it

From Dev

Selecting rows absent from one table against two other tables?

From Dev

How to insert one row of a table into two rows of another table

From Dev

Inserting all rows one by one into a empty table by selecting the rows from another table in SQL Server

From Dev

Insert many rows from a table into one unique row in another table

From Dev

How to push one table values to another table by selecting one or more row using angular 2

From Dev

Selecting rows that are included in a set from another table

From Dev

MySQL select row with two matching joined rows from another table

From Dev

Join three rows with one row from another table

From Dev

Make one row in result table from two rows in SQLite

From Dev

Selecting one record from two tables and multiple records from another table in ONE query

From Dev

Selecting rows from one table where value and order from another in MYSQL

From Java

Using data.table to select rows by distance from another row

From Dev

Select two rows, using data from one row

From Dev

Selecting rows from a table depending on keywords in another table

From Dev

Add row when selected from one table to another using php

From Dev

How to submit row from one table to another using php, msqli

From Dev

Add row when selected from one table to another using php

From Dev

PostgreSQL for each row from one table join all rows from another table

From Dev

What is the best way for selecting 2 row from table in one row?

From Dev

selecting records from main table and count of each row in another table

From Dev

how to select one row from one table and multiple rows from other table using joins in mysql,

From Dev

Subtract rows of one table from another table

From Dev

MYSQL Single query to retrieve both single row from one table and many rows as a single field from another

From Dev

Link one row of table to multiple rows in another table in MySQL

From Dev

MySQL query - single row in one table with multiple rows in another table

From Dev

SELECT one row of a table, And all rows in another table

From Dev

mysql - move rows from one table to another

Related Related

  1. 1

    Taking ids from two rows of one MySQL table and entering those values in one row of another MySQL table using PHP

  2. 2

    selecting unique rows from one table according to another table and then sorting it

  3. 3

    Selecting rows absent from one table against two other tables?

  4. 4

    How to insert one row of a table into two rows of another table

  5. 5

    Inserting all rows one by one into a empty table by selecting the rows from another table in SQL Server

  6. 6

    Insert many rows from a table into one unique row in another table

  7. 7

    How to push one table values to another table by selecting one or more row using angular 2

  8. 8

    Selecting rows that are included in a set from another table

  9. 9

    MySQL select row with two matching joined rows from another table

  10. 10

    Join three rows with one row from another table

  11. 11

    Make one row in result table from two rows in SQLite

  12. 12

    Selecting one record from two tables and multiple records from another table in ONE query

  13. 13

    Selecting rows from one table where value and order from another in MYSQL

  14. 14

    Using data.table to select rows by distance from another row

  15. 15

    Select two rows, using data from one row

  16. 16

    Selecting rows from a table depending on keywords in another table

  17. 17

    Add row when selected from one table to another using php

  18. 18

    How to submit row from one table to another using php, msqli

  19. 19

    Add row when selected from one table to another using php

  20. 20

    PostgreSQL for each row from one table join all rows from another table

  21. 21

    What is the best way for selecting 2 row from table in one row?

  22. 22

    selecting records from main table and count of each row in another table

  23. 23

    how to select one row from one table and multiple rows from other table using joins in mysql,

  24. 24

    Subtract rows of one table from another table

  25. 25

    MYSQL Single query to retrieve both single row from one table and many rows as a single field from another

  26. 26

    Link one row of table to multiple rows in another table in MySQL

  27. 27

    MySQL query - single row in one table with multiple rows in another table

  28. 28

    SELECT one row of a table, And all rows in another table

  29. 29

    mysql - move rows from one table to another

HotTag

Archive