sql on mysql about join -
the code below provide result infact want list customer never buy somethink how can fix code below
select webboard.listweb.id, webboard.listweb.iditempro, webboard.listweb.url, webboard.listweb.useradddate, webboard.listweb.expiredate, webboard.prorecord.urlpostonweb webboard.prorecord.urlpostonweb webboard.listweb , webboard.prorecord listweb.id not in (select webboard.prorecord.idlist webboard.prorecord )
using syntax
from webboard.listweb , webboard.prorecord
will perform cartesian, or cross, join on tables involved. every row in table listweb
rows in prorecord
displayed.
you need use inner join
select rows in listweb
have related rows in prorecord
table. fields identify rows (your primary keys) , name of foreign key field in prorecord
table?
edit: re-read question , comments , see want rows in listweb
do not have entry in prorecord
your select
like:
select webboard.listweb.id, webboard.listweb.iditempro, webboard.listweb.url, webboard.listweb.useradddate, webboard.listweb.expiredate, webboard.prorecord.urlpostonweb -- webboard.prorecord.urlpostonweb -- have field twice webboard.listweb left join webboard.prorecord on webboard.listweb.id = webboard.prorecord.idlist -- i'm guessing @ foreign key here webboard.prorecord.idlist null
Comments
Post a Comment