Hi,
Sorry for asking question again. cur_t.execute("""
SELECT firstname, lastname
FROM authors;
""")
for row in cur_t:
cur_p.execute("""
INSERT INTO lib_author (
created, modified, last_name,
first_name, country,
school_id, name)
VALUES (current_timestamp, current_timestamp, %s, %s, %s,
(SELECT id FROM ed_school WHERE name='My Test School'),
(SELECT CONCAT(first_name, ',', last_name) AS name FROM lib_author LIMIT 1)
)
""", (row['lastname'], row['firstname'], ''))
for row in cur_t:
cur_p.execute("""
INSERT INTO lib_author (
created, modified, last_name,
first_name, country,
school_id, name)
VALUES (current_timestamp, current_timestamp, %s, %s, %s,
(SELECT id FROM ed_school WHERE name='My Test School'),
)
""", (row['lastname'], row['firstname'], '', (row['firstname'], row['lastname']) )
""", (row['lastname'], row['firstname'], '', (row['firstname'], row['lastname']) )
The second code works but it includes the parenthesis in the DB.
How can I remove the ( ) in the DB? I can't call the row['firstname'] and row['lastname'] as values without using ( ).
Any suggestion is highly appreciated.
Thanks,
J