title: How to write sql COALESCE in Django
body: <p>I'm new to Django. How to write COALESCE sql queryset in to django orm.</p>
  
  <pre><code>query = 'SELECT COALESCE(max(CAST(order_no as UNSIGNED)), 0) as o,id from nanossc_Sales_master'
  </code></pre>
  
  <p>models.py</p>
  
  <pre><code>class Sales_master(models.Model):
      slno = models.IntegerField(blank=True, null=True)
      order_no = models.CharField(max_length=50, blank=True, null=True)
      type = models.CharField(max_length=50, blank=True, null=True)
      customer_id = models.CharField(max_length=50, blank=True, null=True)
      customer_name = models.CharField(max_length=50, blank=True, null=True)
      brand_name = models.CharField(max_length=50, blank=True, null=True)
      name = models.CharField(max_length=50, blank=True, null=True)
  </code></pre>