Quantcast
Channel: MySQL Forums - MySQL Workbench
Viewing all articles
Browse latest Browse all 3739

Query problem - joining two tables where col1<>col2 (no replies)

$
0
0
Hi all,

I have two tables, a and B.

table A holds a series of transactions of movements between locations, denoted by numbers.

for example:
FROM --> TO

1 -> 6
5 -> 7
7 -> 9
8 -> 11
11 --> 1
1 --> 5

i then want to select every transaction FROM a given set of numbers TO not the given set of numbers.

so, for example, i want to see all the transactions where '1' is in the FROM and '1' is NOT in the TO.

So i joined this table to the table holding the required set of number restrictions in the format

join (table A) a ON a.from=b.list AND a.from<>b.list

but this returns garbage. I've tried using seperate join statements, and i've tried ON.. WHERE.. and I just can't see what I'm doing wrong ? any ideas ?

Viewing all articles
Browse latest Browse all 3739

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>