I have the query below which works great.
SELECT `Despatch`.`DespatchNumber` , `Despatch`.`Product` ,
`Stock`.`ProductNumber` , `Stock`.`Description` ,
`Stock`.`ProductGroup` , `Stock`.`Size` , `Stock`.`IPICODE` , `Stock`.`Fit` ,
`Stock`.`62`
FROM Stock , Despatch
WHERE `Despatch`.`DespatchNumber` = '" . $Despatch . "'
AND `Despatch`.`Product` = `Stock`.`ProductCode`
My problem is i want to expand it that im using the value of $Despatch to search another column in the same table using an OR function. So the query will look into Despatch Number and if it does not find one matching then it looks into order number as below. It doesnt work and my mysql server just hangs trying to run this query.
SELECT `Despatch`.`DespatchNumber` , `Despatch`.`Product` ,
`Stock`.`ProductNumber` , `Stock`.`Description` , `Stock`.`ProductGroup` , `Stock`.`Size` , `Stock`.`IPICODE` , `Stock`.`Fit` , `Stock`.`62`
FROM Stock , Despatch
WHERE `Despatch`.`DespatchNumber` = '" . $Despatch . "'
OR `Despatch`.`OrderNumber` = '" . $Despatch . "'
AND `Despatch`.`Product` = `Stock`.`ProductCode`