you need to get a row with data from the Group table and replace them with, for example [3] - [2], the first values ββin square brackets means that you need to take the row with the data 'tractor' from the List 3 table and another value from the Brand table John Dear and these value put in two different variables
tractor - john deere
car - audi
motorcycle - ducati
database structure:
List |---------|----------| | list_id | title | |---------|----------| | 1 | ΠΌΠ°ΡΠΈΠ½Π° | |---------|----------| | 2 | ΠΌΠΎΡΠΎΡΠΈΠΊΠ» | |---------|----------| | 3 | ΡΡΠ°ΠΊΡΠΎΡ | |---------|----------| Brand |---------|----------| |brand_id | title | |---------|----------| | 1 | Π°ΡΠ΄ΠΈ | |---------|----------| | 2 | Π΄ΠΆΠΎΠ½ Π΄ΠΈΡ | |---------|----------| | 3 | Π΄ΡΠΊΠ°ΡΠΈ | |---------|----------| Group |----------|-------------------| | Group_id | text | |----------|-------------------| | 1 | [4]-[23], | | | [9]-[3] | |----------|-------------------| | 2 | [2]-[37], | | | [8]-[41], | | | [11]-[24], | | | [2]-[15] | |----------|-------------------| Code
def my_db(): conn = sqlite3.connect('db.sqlite') c = conn.cursor() c.execute('SELECT * FROM List WHERE list_id = 1') row = c.fetchone() # Π·Π°ΠΊΡΡΠ²Π°Π΅ΠΌ ΡΠΎΠ΅Π΄ΠΈΠ½Π΅Π½ΠΈΠ΅ Ρ Π±Π°Π·ΠΎΠΉ c.close() conn.close() return row
join- splash58