I'm new on Python and would need some help for the following :
I'm building a CRM using Tkinter and Mysql database.
My database was quite big so I decided to split it into several tables (to avoid the VARCHAR limitation among other).
So far I have 5 tables named CRM1, CRM2, CRM3, CRM4, CRM5 and each one have a column "id" as primary key.
As I need to be able to search in the whole database I would like to JOIN all those 5 tables in one query but so far I only succeed to joining the first 2. when I add a second JOIN statement the query fails ...
Here is what I have working so far : (searched is an ENTRY box .get)
sql = "SELECT * "
"FROM CRM1 "
"JOIN CRM2 "
"ON CRM1.id = CRM2.id "
"WHERE "
"contact_last_name_1 LIKE '%" + searched + "%' OR "
"project_1_piano_brand LIKE '%" + searched + "%' ORDER BY CRM1.id DESC"
I tried to add another JOIN statement like this :
sql = "SELECT * "
"FROM CRM1 "
"JOIN CRM2 "
"ON CRM1.id = CRM2.id "
"JOIN CRM3 "
"ON CRM1.id = CRM3.id "
"WHERE "
"contact_last_name_1 LIKE '%" + searched + "%' OR "
"project_1_piano_brand LIKE '%" + searched + "%' OR "
"project_2_piano_brand LIKE '%" + searched + "%' ORDER BY CRM1.id DESC"
But the query returns nothing ..
Can somebody tells me what I'm doing wrong ?
Thanks in advance for your help.