title: Query IsDeleted = 0 on all tables
body: <p>In my database, I have 9 tables and I need to create a view.</p>
  
  <p>This view will eventually query all tables. The one consistency here is that there is a column in all tables for IsDeleted. How do I run a query to check the column in all tables where IsDeleted = 0?</p>
  
  <p>The three tables are: Customers, County, Country</p>
  
  <p><strong>This is my View:</strong></p>
  
  <pre><code>CREATE VIEW vwTEST
  AS
  SELECT
      Cus.CustomerId,
      Cus.FirstName,
      Cus.LastName,
      Cty.CountyName,
      Cry.CountryName
  FROM
      Customers Cus
  LEFT JOIN
      County Cty
  ON  
      Cus.CountyId = Cty.CountyId
  WHERE 
      Cus.IsDeleted = 0
  LEFT JOIN
      Country Cry
  ON
      Cus.CountryId = Cry.CountryId
  WHERE 
      Cry.IsDeleted = 0
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/UHFWu.jpg" rel="nofollow noreferrer">Table formats</a></p>