mysql - Selecting empty records depending on left join other table -


i have select statement below. tblplayer contains 709 records game = 'fps'. tblplayerpoints contains 1 record values (2, 'fps', 812, 0). sql should return 709 records can run through inserting values (1, 'fps', playerid, 0). upon running select below, returns 708 records. excludes record allready existing.

it should ignore record because first value (2) different new first values (1). tried adding , tblplayerpoints.gamenumber < 2 0 records instead of 709.

upon removing tblplayerpoints.points null 709 records. can't remove line, because if row values (1, 'fps', playerid, 0) allready exists shouldn't add line again.

select 1 , 'fps', tblplayer.playerid, 0 tblplayer left join tblplayerpoints on tblplayer.id = tblplayerpoints.playerid tblplayer.game = 'fps' , tblplayer.subscription = '1' , tblplayerpoints.points null  

full insert example:

insert tblpronoploegritpunten ("1","fps",playerid,"0")  select 1 , 'fps', tblplayer.playerid, 0 tblplayer left join tblplayerpoints on tblplayer.id = tblplayerpoints.playerid tblplayer.game = 'fps' , tblplayer.subscription = '1' , tblplayerpoints.points null  

this full insert should add 709 records tblplayerpoints if change "1"s inside full insert example (except subscription) "2"s should add 708 records because there's allready 1 record starting value 2.

from understand of problem, instead of

and tblplayerpoints.gamenumber null 

you may want go

and ifnull(tblplayerpoints.gamenumber,0) <> 1 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -