NetITSysAd OJT
NetITSysAd OJT

Reputation: 11

MySQL, display data not shown when using '=' command

Is there a way for me to also print out values not equal to each other?

I used a command:

WHERE displayname = personnel

I have 800+ data not shown, how can I show these data?

Note personnel and data are from two different tables.

My whole script looks like this:

SELECT a.something, a.somethins2, b.something1, b.something2
FROM a, b
WHERE a.displayname = b.personnel

Upvotes: 0

Views: 49

Answers (3)

Zahid Ali
Zahid Ali

Reputation: 466

if you are trying to get the record that matched a.displayname = b.personnel and not matched from table a:

SELECT a.something, a.somethins2, b.something1, b.something2
FROM a LEFT JOIN b
ON a.displayname = b.personnel

Upvotes: 0

Vamshi .goli
Vamshi .goli

Reputation: 520

Try with this

select * from table_name1 t1,table_name2 t2 where 
column_name!='".$data."' 
and t2.id=t1.id

Upvotes: 0

Mureinik
Mureinik

Reputation: 311188

!= is the "not equals" operator, so you could have a WHERE displayname != personnel clause. A full query would probably look like this:

SELECT displayname, personnel
FROM   some_table t1
JOIN   some_other_table t2 ON t1.id = t2.id
WHERE  displayname != personnel

Upvotes: 1

Related Questions