Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How to get all records NOT found from query and how to do a word search from Excel list? [closed]
- SELECT <fields>
- FROM Table1
- WHERE Field1 NOT IN (SELECT Field1 FROM Query1)
- SELECT DISTINCT temp.id, temp.name
- FROM(
- ( /* your first query */
- SELECT table1.id AS id, table1.name AS name
- FROM mytable AS table1
- WHERE (CONDIDION)
- )
- UNION /* combine both queries, make sure their columns match */
- ( /* your second query with the records not included in the first */
- SELECT table2.id AS id, table2.name AS name
- FROM mytable AS table2
- WHERE (CONDIDION)
- )
- ) AS temp;
- SELECT DISTINCT temp.id, temp.name
- FROM(
- ( /* select all rows in your first table */
- SELECT table1.id AS id, table1.name AS name
- FROM mytable AS table1
- )
- EXCEPT /* use except or your language equivalent */
- /*make sure their columns match */
- ( /* put your first query here */
- SELECT table2.id AS id, table2.name AS name
- FROM mytable AS table2
- WHERE (CONDIDION)
- )
- ) AS temp;
Add Comment
Please, Sign In to add comment