Select results from one query to another

Brent Smith
SELECT id FROM table1 WHERE name LIKE 'test%'; 

That would show me all the ids in table1 with the id of anything that matched test%. So I have been doing this the long way doing this :

SELECT * FROM table2 WHERE id = '1011';

Is there anyway to make my table1 query jump and auto insert to WHERE id = '1011', I'd like it to auto match it up whats in query one to query two. Instead of having to run the second query over and over again and get all the results faster.

bhamby

You want to do a JOIN:

SELECT a.*
FROM table2 a
JOIN table1 b
  ON a.id = b.id
WHERE b.name LIKE 'test%'

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Using the results of one query as a subarray in the results of another

분류에서Dev

Importing query results from another database

분류에서Dev

Haystack: Make query from one project to another

분류에서Dev

best way to select data from one table or another

분류에서Dev

Select from one table and order by column of another table

분류에서Dev

No results from SQL Query

분류에서Dev

Trim Trailing 0 from one colum in query Select *

분류에서Dev

Select2 Copy values from one select2 to another

분류에서Dev

how to get SELECT * FROM TABLE results into more than one variable in c#

분류에서Dev

Select Into #Temp From Select Query

분류에서Dev

SQL query to select from one table based on a column value in other table

분류에서Dev

Select from another select without temporary table?

분류에서Dev

Substract query from another query in SQL Server

분류에서Dev

Importing variable from another module results in AttributeError

분류에서Dev

Mysql: First Select then Update in One Query

분류에서Dev

Trying to filter results from a query using CASE

분류에서Dev

Concatenating and grouping results from a mysql query

분류에서Dev

Cross referencing results from query's

분류에서Dev

Change the value of a select after a query in database triggered by the change of another select

분류에서Dev

How to select one row with max(select field) and another (specific field)?

분류에서Dev

MYSQL - Return Result of one SELECT minus another SELECT

분류에서Dev

MySQL Random Select Query with limit returning different number of results (undesired)

분류에서Dev

Which one of these two fields results in faster database query?

분류에서Dev

SQL Server - Merge multiple query results into one result set

분류에서Dev

Echo value from id using another query?

분류에서Dev

copying files from one directory to another

분류에서Dev

create an instance of one class from another class

분류에서Dev

Notifying data change from one activity to another

분류에서Dev

Dart, how to transform from one iterable to another?

Related 관련 기사

  1. 1

    Using the results of one query as a subarray in the results of another

  2. 2

    Importing query results from another database

  3. 3

    Haystack: Make query from one project to another

  4. 4

    best way to select data from one table or another

  5. 5

    Select from one table and order by column of another table

  6. 6

    No results from SQL Query

  7. 7

    Trim Trailing 0 from one colum in query Select *

  8. 8

    Select2 Copy values from one select2 to another

  9. 9

    how to get SELECT * FROM TABLE results into more than one variable in c#

  10. 10

    Select Into #Temp From Select Query

  11. 11

    SQL query to select from one table based on a column value in other table

  12. 12

    Select from another select without temporary table?

  13. 13

    Substract query from another query in SQL Server

  14. 14

    Importing variable from another module results in AttributeError

  15. 15

    Mysql: First Select then Update in One Query

  16. 16

    Trying to filter results from a query using CASE

  17. 17

    Concatenating and grouping results from a mysql query

  18. 18

    Cross referencing results from query's

  19. 19

    Change the value of a select after a query in database triggered by the change of another select

  20. 20

    How to select one row with max(select field) and another (specific field)?

  21. 21

    MYSQL - Return Result of one SELECT minus another SELECT

  22. 22

    MySQL Random Select Query with limit returning different number of results (undesired)

  23. 23

    Which one of these two fields results in faster database query?

  24. 24

    SQL Server - Merge multiple query results into one result set

  25. 25

    Echo value from id using another query?

  26. 26

    copying files from one directory to another

  27. 27

    create an instance of one class from another class

  28. 28

    Notifying data change from one activity to another

  29. 29

    Dart, how to transform from one iterable to another?

뜨겁다태그

보관