I had this code (which worked fine) in a calculated database that joined two SQL datasources:
select m.Email, m.SkuID,m.SkuName,l.Email,l.LastLogin,l.DocsAdded
from Licenses m
inner join ActivityReport l on l.Email = m.Email
Due to a bug in the reports API that provides incorrect information on LastLogin
time information, I'm using the Users.get API and writing that information a new datasource (just the email of the user and their last login time). I want to join this with my other two data sources. Using the below code:
select m.Email, m.SkuID,m.SkuName,l.Email,l.DocsAdded,x.Email,x.LastLogin as LastLogin
from Licenses m
inner join ActivityReport l on l.Email = m.Email
inner join LastLogin x on x.Email = l.Email
I get the error:
License save batch failed: JDBC backend failure. More information: Failed to execute connection with error: Deadlock found when trying to get lock; try restarting transaction
I also get two errors that looks like this: License save batch failed: Malformed SQL. More information: Error with SQL statement: Duplicate entry 'user@email.com' for key 'PRIMARY'.
What am I doing wrong?