Question: I am trying to work out how the SQL if I want to bring back ALL "Names" from table1 and only list the output in Column 2 to contain the value if it is "Apple". If its not "Apple" or is "Null" then column 2 should also be "Null"

Table 1

| **ID(pk)** | **Name** |
| --- | --- |
| 24 | Boris |
| 25 | Dominic |
| 26 | Rishi |
| 27 | Elizabeth |
| 28 | Ben |

Table 2

| **ID(fk)** | **Description** |
| --- | --- |
| 27 | Apple |
| 27 | Orange |
| 27 | Pear |
| 26 | Apple |
| 26 | Pear |
| 25 | Pear |
| 24 | Orange |

Required Output

| **Name** | **Description** |
| --- | --- |
| Boris |  |
| Dominic |  |
| Rishi | Apple |
| Elizabeth | Apple |
| Sajid |  |

Answer: 
C++20 concepts make things much easier:

```
template <class... Ts>
struct Foo {};

template<class T>
concept IsFoo = requires(T& t){ 
  []<class... Ts>(Foo<Ts...>&){}(t);  
};

```

[Demo.](https://godbolt.org/z/qxh7zTohb)
You can do it this way:

```
  #include <type_traits>

  template <class A, class B> class Foo {};

  class Bar : public Foo<int, float> {};

  template <class A, class B> 
  std::true_type checkFoo(const Foo<A,B>&);

  std::false_type checkFoo(...);

  int main()
  {   
      Bar bar;
      int baz;
      static_assert(decltype(checkFoo(bar))::value, "bar test failed");;
      static_assert(!decltype(checkFoo(baz))::value, "baz test failed");;
  }                                                         

```