Sample Header Ad - 728x90

MYSQL get rows not axisting in other table

-1 votes
2 answers
128 views
I have two tables with 1 identical data column for comparison. One table "species" is a wide list of species and each data row has one unique id called "suid" add. to its primary id as usual. The second table "printpipe" is a shopping cart for printouts and each row has the suid from the species and a unique personal id from the user "guid". Now I want to get all rows from "species" having empty field "stockimg" and not "noimage.png" in field "stockimg" AND do not exist in table "printpipe" with same suid AND having memb_guid identical to users guid I have as variable $guid My query I tried is: $get_allspecies = $mysqli->query("SELECT * FROM species WHERE stockimg 'noimage.png' AND stockimg '' AND NOT EXISTS (SELECT * FROM printpipe WHERE printpipe.suid = species.suid AND memb_guid = '$guid') ORDER BY name_sc, name_de"); But it doesn't work. What am I doing wrong?
Asked by BigMac (1 rep)
Feb 21, 2021, 01:58 PM
Last activity: Feb 27, 2021, 11:28 AM