Skip to content

How to write multiple sql queries depend on one sql in a transaction? #83

@JackGzj

Description

@JackGzj

I want to execute 3 SQL in a transaction:

INSERT INTO `order`(order_user,total_price,order_time) VALUES (?,?,?);
INSERT INTO order_detail(order_id,book_id,count) VALUES (?,?,?);
INSERT INTO order_detail(order_id,book_id,count) VALUES (?,?,?)

The second and third SQL statements depends on the first one (need to get the insert id), I wonder how should I write the code to make the transaction works using the serverless-mysql module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions