mardi 2 juin 2020

Need assistance with if statement in Python code for SQL

If I want to filter my table using an if statement how would I go about doing this.

I have an example of what I am wanting to do but not sure how to achieve this.

I want to pull a few values based off of the fact that a customer order is active/inactive.

With my sql column being a bit value type I want to only show "orders" based off of active (column value of 0) orders.

Below is my line of code to pull part numbers, customer number, order numbers:

        '''for row in cur:
                custOrders = CST.OrderLog(row[22], row[23], row[39])
                listofCustOrders.append(custOrders)
        return listofcustOrders'''

row22 is my part number row23 is my cust number row39 is my cust order number

I need to sort my customer order number based off the active/inactive column (row[2]) which consists of just 0,1,NULL values.

Any ideas, I have not worked with if statements regarding a SQL connection before.

Thanks

Aucun commentaire:

Enregistrer un commentaire