<?php 
	$my_device = mysqli_query($con,"select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	WHERE stdevice.stdev_id = '$stdev_id' ");
	$count_yes = mysqli_num_rows($my_device);
?>

<?php 
	$my_device = mysqli_query($con,"select * from stdevice    
	LEFT JOIN stlocation ON stdevice.stdev_id = stlocation.stdev_id
	LEFT JOIN device_name ON device_name.dev_id = stdevice.dev_id
	WHERE stdevice.stdev_id = '$stdev_id'  ");
	$count_no = mysqli_num_rows($my_device);
?>

<?php $not_count = $count_yes -  $count_no; ?>