How could i join this multi query with just a single mysql query ?
$query = $mysql->query("select rate from postages where city=$city");
if($query->num_rows == 0)
{
$query = $mysql->query("select rate from postages where subdistrict=$subdistrict");
if($query->num_rows == 0)
{
$query = $mysql->query("select rate from postages where district=$district");
}
}
Thanks for your help.
If you wanted to get the exact same result as you have in your example you could do:
You could also do it another way… Which only runs the district query if where is the city query returns 0 rows, and only runs the subdistrict call if the district query returns 0 rows: