I have 2 my tables with data and 2 "not mine" tables (in ReferenceDB) where thing ID can be mapped to its name.

One of mine tables is orders with following important columns: `charName, stationID, typeID, bid.`

Another table has following important columns: `transactionDateTime, stationID, typeID, person, transactionType`

I started my head braking with idea how to find orders that doesn't have any records for them lately (e.g. given amount of days). But for beginning I set me a task just to find orders that has no records for them at all. For that I figured out `LEFT JOIN` see biggest query below.

An order for me is a combination of `charName/persone` + `stationID` + `typeID` + `transactionType/bid` so if actually one of those four changes it is different order then.

Problem is that transactionType can be "yes" or "no" and bid is 0 or not 0. So I cant or **DON'T KNOW HOW** to `JOIN ON` different data types. So logically I'd like to join on 4 columns like:

```
FROM ordersTable LEFT JOIN recordsTable ON ordersTable.typeID = recordsTable.typeID 
AND ordersTable.stationID = recordsTable.stationID 
AND ordersTable.charName = recordsTable.person 
AND ordersTable.bid = recordsTable.transactionType 

```

Clearly last string of above wouldn't work cause of different data types.
So for a moment I thought that I can do such query twice for *bid=0 with transactionType="yes"* and second time for *bid != 0 and transactionType = "no"* **see my query below** for *0/"yes"* combination. But seems it doesn't works exactly as I'd like it to. because `AND ordersTable.bid IN (0) AND recordsTable.transactionType="yes"` in JOIN ON doesn't sem do anything. (As I do get results where bid=1)

```
SELECT invTypes.typeName, stastations.stationName, main.* FROM referenceDB.invTypes, referenceDB.stastations, (
SELECT ordersTable.charName, ordersTable.stationID, ordersTable.typeID, ordersTable.bid, ordersTable.orderState, ordersTable.volRemaining
FROM ordersTable LEFT JOIN recordsTable ON ordersTable.typeID = recordsTable.typeID 
AND ordersTable.stationID = recordsTable.stationID 
AND ordersTable.charName = recordsTable.person 
AND ordersTable.bid IN (0) AND recordsTable.transactionType="yes" 
WHERE recordsTable.typeID IS NULL 
AND ordersTable.orderState IN (0) ) as main
WHERE stastations.stationID = main.stationID AND invTypes.typeID = main.typeID;

```

**Questions:**
Is it possible to tell mySQL to treat "yes" as 0 or vise versa? If yes how do I do it in my query? If no what would be my work around (to find orders that doesn't have records related to them)?

And possibly some one can suggset a query that will find orders that didn't have records within given amount of days?

Thank you in advance!