Jan-07-2022, 02:25 AM
I am trying to use a " * " in a a SQL WHERE clause passed in as an argument. The reason is to return the last entered tagNo if they do not know the other two search criteria.
I get no returns with the use of the '*' but do when I pass he exact match for all three WHERE criteria. Can you use wild cards the way i am trying to use them?
I get no returns with the use of the '*' but do when I pass he exact match for all three WHERE criteria. Can you use wild cards the way i am trying to use them?
tagNo=self.cow_detBtn['tag'].text tagClr=self.cow_detBtn['tagClr'].text tagYr=self.cow_detBtn['tagYr'].text if tagNo!='' and tagClr!='' and tagYr!='': cow=self.db.searchCow(tagNo,tagClr,tagYr) elif tagNo!='' and tagClr!='' and tagYr=='': cow=self.db.searchCow(tagNo,tagClr,'*') elif tagNo!='' and tagClr=='' and tagYr!='': cow=self.db.searchCow(tagNo,'*',tagYr) elif tagNo!='' and tagClr=='' and tagYr=='': cow=self.db.searchCow(tagNo,'*','*') def searchCow(self,tagNo,tagClr,tagYr): self.c.execute('SELECT * From cowTbl where tagNo=? and tagClr=? and tagYr=? LIMIT 1',(tagNo,tagClr,tagYr)) cows=self.c.fetchall() return cows