NigelRel3
-
Posts
69 -
Joined
-
Last visited
Community Answers
-
NigelRel3's post in check constraint was marked as the answer
Your check if the shirt number already exists is checking that a player_id already exists - nothing to do with the shirt number (or team)!
I'm not sure if your database structure is correct though - if a player is just part of one team - then put the team number on the player record . If you want players to be in multiple teams - then put shirt number of the other record.
Then create a unique key on team, shirt number.
-
NigelRel3's post in Update 2 query in sql using php was marked as the answer
As already mentioned - using multiple statements in one string will not work.
You could rewrite your query though to be something like
UPDATE stock s1, stock s2 set s1.qty = s1.qty-1, s2.qty = s2.qty +1 where s1.id= 1 and s2.id= 1 you'll have to change the names as appropriate - and BIND the variables for the ID's.
-
NigelRel3's post in MYSQL Left Join single row not found in a was marked as the answer
You could use something like
select c.* from customers c where not exists (select 1 from type t where c.customer_id = t.customer_id and t.type in ('macintosh')) All this does is find the people where a record isn't found for a set of types.