Kye
Kye

Reputation: 1

Joining tables through Python MySQLdb

I am a recent user of python and MySQLdb and I want to know why I am unable to recieve a result by running a sql query in python. The query I ran was: "SELECT dividend FROM Dividends, Avatar_recs WHERE Dividends.entityID=Avatar_recs.entityID , Avatar_recs.avatarID='1'"

I recieve an error message saying there is something wrong with my query when I know if I done this query directly on the database it would work.

Who knows where I am going wrong????

Upvotes: 0

Views: 860

Answers (1)

dplante
dplante

Reputation: 2449

You have this:

SELECT dividend
    FROM Dividends, Avatar_recs
    WHERE
        Dividends.entityID=Avatar_recs.entityID , Avatar_recs.avatarID='1'

I would try this - your comma syntax in the where clause doesn't look familiar:

SELECT dividend
    FROM Dividends, Avatar_recs
    WHERE
        Dividends.entityID=Avatar_recs.entityID AND Avatar_recs.avatarID='1'

Upvotes: 2

Related Questions