how to grab the not equal row from joined table in mysql?

user3391137

i have two tables as following

user_job_applied

user_job_applied

company_viewed_user

company_viewed_user

i want to take rows which are not in company_viewed_user table for relevant job_id in user_job_applied table. i wrote the following query for it but it's not grabbed

SELECT
    `user_job_applied`.user_id
FROM
    `user_job_applied`
LEFT JOIN 
    `company_viewed_user` 
ON 
    `company_viewed_user`.user_id ON `company_viewed_user`.user_id = `user_job_applied`.user_id                               
WHERE
    `company_viewed_user`.user_id IS NULL AND
    `company_viewed_user`.emp_id IN (SELECT user_id 
                                     FROM company_user 
                                     WHERE company_id='1') 
AND
    `user_job_applied`.job_id = '1'; 

The output should be as following enter image description here

user3391137

want to move emp_id condition to left join statement from in where clause

SELECT
`user_job_applied`.user_id
FROM
`user_job_applied`
LEFT JOIN `company_viewed_user` ON `company_viewed_user`.user_id = `user_job_applied`.user_id AND 
                                                                `company_viewed_user`.emp_id IN (SELECT user_id FROM company_user WHERE company_id='1')                             
WHERE
`company_viewed_user`.user_id IS NULL AND                        
`user_job_applied`.job_id = '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

How to find single row data from joined table in mysql?

From Dev

MySQL select row with two matching joined rows from another table

From Dev

Grab one row from a table

From Dev

How to retrieve min price via mysql query from a joined table

From Dev

How to concatenate values from joined table in specific order, mysql

From Dev

MySQL LIKE from JOIN clause and GROUP_CONCAT returns only one row from joined table

From Dev

Fetch Column names from a joined mysql table

From Dev

Mysql - Return max value from joined table

From Dev

MYSQL Query a table with a set condition and if a 2nd conidtion is met grab a row(s) from another table and continue

From Dev

How to combine multiple records from a joined table

From Dev

springJPA - How to read from a joined table?

From Dev

Laravel 5.4 - Return single row from joined table

From Dev

MySql limiting only first table from joined table

From Dev

MySQL update query on a single table with value from joined table

From Dev

How do I order mysql query results by values from a joined table's rows (not columns)?

From Dev

How do you pull all data from a joined table when a related record contains a given value in MySQL?

From Dev

MySQL averaging joined table

From Dev

MySQL count on joined table

From Dev

MySQL: Returning total record count from a CROSS JOINed row?

From Dev

How to join only one row in joined table with postgres?

From Dev

SQL Row Concatenation on joined table

From Dev

getting top row of joined table

From Dev

Mysql grab row if condition is met, grab another if not

From Dev

Most recent distinct record from a joined MySQL table

From Dev

Can't Count results from Joined Table mySQL

From Dev

Use Columns From One Left Joined Table In Second Left Joined MYSQL

From Dev

Grab from table values

From Dev

Mysql - How to query a row from table _a that is link to table_b pointing to a different a row in table_a

From Dev

Mysql - How to query a row from table _a that is link to table_b pointing to a different a row in table_a

Related Related

  1. 1

    How to find single row data from joined table in mysql?

  2. 2

    MySQL select row with two matching joined rows from another table

  3. 3

    Grab one row from a table

  4. 4

    How to retrieve min price via mysql query from a joined table

  5. 5

    How to concatenate values from joined table in specific order, mysql

  6. 6

    MySQL LIKE from JOIN clause and GROUP_CONCAT returns only one row from joined table

  7. 7

    Fetch Column names from a joined mysql table

  8. 8

    Mysql - Return max value from joined table

  9. 9

    MYSQL Query a table with a set condition and if a 2nd conidtion is met grab a row(s) from another table and continue

  10. 10

    How to combine multiple records from a joined table

  11. 11

    springJPA - How to read from a joined table?

  12. 12

    Laravel 5.4 - Return single row from joined table

  13. 13

    MySql limiting only first table from joined table

  14. 14

    MySQL update query on a single table with value from joined table

  15. 15

    How do I order mysql query results by values from a joined table's rows (not columns)?

  16. 16

    How do you pull all data from a joined table when a related record contains a given value in MySQL?

  17. 17

    MySQL averaging joined table

  18. 18

    MySQL count on joined table

  19. 19

    MySQL: Returning total record count from a CROSS JOINed row?

  20. 20

    How to join only one row in joined table with postgres?

  21. 21

    SQL Row Concatenation on joined table

  22. 22

    getting top row of joined table

  23. 23

    Mysql grab row if condition is met, grab another if not

  24. 24

    Most recent distinct record from a joined MySQL table

  25. 25

    Can't Count results from Joined Table mySQL

  26. 26

    Use Columns From One Left Joined Table In Second Left Joined MYSQL

  27. 27

    Grab from table values

  28. 28

    Mysql - How to query a row from table _a that is link to table_b pointing to a different a row in table_a

  29. 29

    Mysql - How to query a row from table _a that is link to table_b pointing to a different a row in table_a

HotTag

Archive