Using If and Vlookup in Postgresql This is what my query output looks like and i have modified the data for easier viewing.    

TABLE A
                +--+--------------+----------------+----------------+
                |ID|Item Name     | Num of Sales   | Current Stock  |
                +-----------------+----------------+----------------+
                |67| Yellow Table |              23| 0              |
                |68| Red Glass    |              55| 0              |
                |69| Blue Chair   |              54| 0              |
                |70| Black stool  |              66| 0              |
                +--+--------------+----------------+----------------+ 


However "Current Stock" for "Red Glass" in another table is duplicated because it has actually 2 kind of merchant that provide the stock item in "Table B". This is the output query for the "Table B"

Table B
        +----+--------------+--------------+----------------+
        | Id | Item Name    | Current Stock| Merchant       |
        +----+--------------+--------------+----------------+
        |  68| Red Glass    |             0|Merchant A      |
        |  68| Red Glass    |           700|Merchant B      |
        +----+--------------+--------------+----------------+  


What I am trying to result is like this, where the filter is "Current stock" = 0. Because Red Glass is actually not zero due to having stock in Merchant B.

                +--+--------------+----------------+----------------+
                |ID|Item Name     | Num of Sales   | Current Stock  |
                +-----------------+----------------+----------------+
                |67| Yellow Table |              23| 0              |
                |69| Blue Chair   |              54| 0              |
                |70| Black stool  |              66| 0              |
                +--+--------------+----------------+----------------+ 


Where item similar like "Red Glass" that have more than 1 Merchant in "Table B" should not detected having 0 current stock. I was thinking about doing similar Vlookup in excel to sum the "Current Stock" in Table B. Or using Case When to detect the duplicate row and then sum the "Current Stock" column
This should be easy with a NOT EXISTS subquery. Assuming the tables are as you show them:

selact a.*
from a
where "Current Stock" = 0
  and not exists
      ( select * 
        from b 
        where b.id = a.id
          and "Current Stock" &gt; 0
      ) ;