Matching two columns from different tables - MySQL PHP

dannjoroge

I have two tables in mysql

  • table 1 is vehicles, has records of all vehicles
  • table 2 is contributions, has records of daily contributions from the vehicles

I have a column in both tables called regno

I want a query that will display vehicle regno that is not in contributions

What I tried:

SELECT vehicles.regno FROM vehicles,contributions
WHERE vehicles.regno<>contributions.regno
ORDER BY vehicles.regno;

Please help. thanks in advance.

Danyal Sandeelo
SELECT regno FROM vehicles
WHERE regno NOT IN (SELECT regno FROM contributions);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

perl matching two columns from different tables

From Dev

perl matching two columns from different tables

From Dev

MYSQL / PHP - merge two tables with different columns

From Dev

MySQL - GROUP_CONCAT with two columns from different tables

From Dev

MySql: Single query to calculate from two columns of different tables

From Dev

Adding two columns from two different tables

From Dev

Echo data from two different mysql tables using php

From Dev

Selecting data from two different tables of the same database in PHP/ MYSQL

From Dev

compare two columns from different tables and append values for matching rows to first file

From Dev

Compare two columns in different tables in MySQL

From Dev

Perl: Matching columns from two different files

From Dev

Sum of two columns from two tables - MySQL

From Dev

Compare two columns from different tables

From Dev

Trying to JOIN columns from two different tables

From Dev

Counting the records of two columns from different tables

From Dev

Merge two columns from different tables

From Dev

Combine rows from two tables with different columns?

From Dev

SQL: Count two different columns from two different tables

From Dev

SQL: Count two different columns from two different tables

From Dev

PHP & MYSQL: Insert records in two different tables

From Dev

Compare two values from different tables - MySql

From Dev

MYSQL sum from two different tables group by

From Dev

Compare two values from different tables - MySql

From Dev

calculating with values from two different mysql tables

From Dev

PHP Select * from two different tables?

From Dev

Concat two SELECTS from different tables with different columns

From Dev

MySQL & PHP: Divide two numbers from two different tables with the same date

From Dev

Is possible to join two tables (One Mysql, the other Oracle) from two different servers in PHP?

From Dev

MySQL & PHP: Divide two numbers from two different tables with the same date

Related Related

  1. 1

    perl matching two columns from different tables

  2. 2

    perl matching two columns from different tables

  3. 3

    MYSQL / PHP - merge two tables with different columns

  4. 4

    MySQL - GROUP_CONCAT with two columns from different tables

  5. 5

    MySql: Single query to calculate from two columns of different tables

  6. 6

    Adding two columns from two different tables

  7. 7

    Echo data from two different mysql tables using php

  8. 8

    Selecting data from two different tables of the same database in PHP/ MYSQL

  9. 9

    compare two columns from different tables and append values for matching rows to first file

  10. 10

    Compare two columns in different tables in MySQL

  11. 11

    Perl: Matching columns from two different files

  12. 12

    Sum of two columns from two tables - MySQL

  13. 13

    Compare two columns from different tables

  14. 14

    Trying to JOIN columns from two different tables

  15. 15

    Counting the records of two columns from different tables

  16. 16

    Merge two columns from different tables

  17. 17

    Combine rows from two tables with different columns?

  18. 18

    SQL: Count two different columns from two different tables

  19. 19

    SQL: Count two different columns from two different tables

  20. 20

    PHP & MYSQL: Insert records in two different tables

  21. 21

    Compare two values from different tables - MySql

  22. 22

    MYSQL sum from two different tables group by

  23. 23

    Compare two values from different tables - MySql

  24. 24

    calculating with values from two different mysql tables

  25. 25

    PHP Select * from two different tables?

  26. 26

    Concat two SELECTS from different tables with different columns

  27. 27

    MySQL & PHP: Divide two numbers from two different tables with the same date

  28. 28

    Is possible to join two tables (One Mysql, the other Oracle) from two different servers in PHP?

  29. 29

    MySQL & PHP: Divide two numbers from two different tables with the same date

HotTag

Archive