vendredi 12 juin 2020

How do I solve and write this query?

I have three tables that look sort of like this:

Table1 has 1 row of numbers:

123
124
125
126
127

etc.

Table2 is similar to Table1, but has more elements:

123
124
125
158
152
175

etc.

Main table has many rows and here is where I struggle:

select
   a,
   b,
   c,
   if HIT in Table1 and NO HIT in Table2 then '1G'
   else if HIT in Table1 AND HIT in Table2 then '2G'
   else d,
   e,
   f,
   g,
   etc
from Table3

Sort of messy explained, but I don't know how to say it better... Sorry!

Hope some of you guys can help me with this issue!

-Geir A.

Aucun commentaire:

Enregistrer un commentaire