user2542929
user2542929

Reputation: 27

python sql mysql

I've got an SQL query which I can not make work: it's like this:

select creation_time as date, abs(USD_amount) as amount 
from pending_transactions as p 
    inner join users as u 
           on u.user_id = p.user_id 
where (p.transaction_status = 'black' or p.transaction_status = 'green' or  
       p.transaction_status = 'gray) and u.referrer = 309 and
       creation_time > '0000-00-00 00:00:00' order by creation_time asc

I use MySQLdb in Python to access a DB but it says that it's wrong. If anyone could help me to make it work it would be so much appreciated.

Upvotes: 0

Views: 42

Answers (1)

user3522371
user3522371

Reputation:

THis should work:

select creation_time as date, abs(USD_amount) as amount 
from pending_transactions as p 
    inner join users as u 
           on u.user_id = p.user_id 
where (p.transaction_status = 'black' or p.transaction_status = 'green' or  
       p.transaction_status = 'gray') and u.referrer = 309 and
       creation_time > '0000-00-00 00:00:00' order by creation_time asc

Because you forgot one '

Upvotes: 1

Related Questions