title: IF in Sentence SQL
body: <p>I would like to help me with a sentence, I have the next table</p>
  
  <pre><code>publications
  ------------
  id_publication,
  publication,
  flag,
  id_user_dest,
  id_user_source
  </code></pre>
  
  <p>It is an application of publications, where you can publish to other users, and also when publishing is a choice if you want a publication private (for that is the flag) and just look at it the user source and destination user, but not as make that sentence.</p>
  
  <p>I have a table users where are the data users, and management 
  sessions, in table PUBLICATIONS look who made the source publication and destination publication.</p>
  
  <p>For example, if I am in the profile "Juan"</p>
  
  <p>I program that spew me all publications that have been for $id_user_profile which is equal to Juan him out by GET</p>
  
  <pre><code>SELECT * FROM publications 
  WHERE id_user_dest= '$id_user_profile' AND flag=0;
  </code></pre>
  
  <p>(Flag: 0 is public, and 1 is private) </p>
  
  <p>In this sentence  I would throw all publications of the user profile, less private, and lack... if the SESSION that time equals id_user_dest or id_user_source, then if you show me the publication Flag 0.</p>
  
  <p>How would the sentence if I want all publications appear only the flag=0 (public), but if flag=1 and the session equals id_user_source or id_user_dest, then the publication also appears  ?</p>
  
  <p>thanks for read :)</p>