Hi Everybody... I have a query that works as follows:
Code: db.query("""SELECT traveler.travelerFirstName,vaccine.vaccineName from (traveler INNER JOIN takenvaccine ON traveler.travelerID = takenvaccine.travelerID) INNER JOIN vaccine ON takenvaccine.vaccineID=vaccine.vaccineID INNER JOIN requiredvaccine ON vaccine.vaccineID=requiredvaccine.requiredvaccineID INNER JOIN city ON requiredvaccine.cityID = city.cityID WHERE traveler.travelerFirstName = 'John'""") The output gives me all vaccines taken by a given employee. To allow the user to choose different names when running the system, I am trying to use a variable, named *person*: Code: person = "John" db.query("""SELECT traveler.travelerFirstName,vaccine.vaccineName from (traveler INNER JOIN takenvaccine ON traveler.travelerID = takenvaccine.travelerID) INNER JOIN vaccine ON takenvaccine.vaccineID=vaccine.vaccineID INNER JOIN requiredvaccine ON vaccine.vaccineID=requiredvaccine.requiredvaccineID INNER JOIN city ON requiredvaccine.cityID = city.cityID WHERE traveler.travelerFirstName = 'person'""") Then I run the query inside my python program. The first version without variable works fine. But the second, using variable, doesn't give me any output. What I am missing here about the python variable sintaxe to make the MySQL work with variable ... Any suggestion? All comments or suggestions are highly appreciated! Threader
-- http://mail.python.org/mailman/listinfo/python-list