I've been working on it for hours and what seems to be a very simple query is driving me (quite) crazy.
I have 2 tables:

Items

```
Code    Var
AAI85CLASS2000              9005N
AAI85CLASS2000              9005P

```

Times

```
Code            Var     Time
AAI85CLASS2000  NULL    8,68
AAI85CLASS2000  CROM    9,68
AAI85CLASS2000  9005N   19,68

```

Result I'd like to get

```
Code                        Var     Time
AAI85CLASS2000              9005N   19,68
AAI85CLASS2000              9005P   8,68

```

When there's a matching Var, the specific Time should be considered. When there's no matching Var, the generic Time (where Var is NULL) should be considered.
I ask for help. Thanks.