Sunday 15 June 2014

php - SQL Format difficulty -



php - SQL Format difficulty -

i have question sql statement. have next statement:

select id, user_id, receiver friend messages user_id = %d || receiver = %d

in same table (messages) 2 more fields:

storage_a

storage_b

now want else sql:

i want select rows storage_a != 0 when user_id = %d

and

i want select rows storage_b != 0 when receiver = %d

use and status add together checking below

select id, user_id, receiver friend messages (storage_a != 0 , user_id = %d) , (storage_b != 0 , receiver = %d)

even though said, want both status match think want or between them. where status be

where (storage_a <> 0 , user_id = 8) or (storage_b <> 0 , receiver = 9)

php mysql sql

No comments:

Post a Comment