vendredi 8 juillet 2016

I want to insert data from first SQL table into second one also with an extra column not present in the second one

So currently I am using this query

INSERT INTO tb_first_wallet_transactions 
(
    vendor_id, 
    amount, 
    transaction_type, 
    status, 
    checksumhash
)
SELECT 
    vendor_id, 
    amount, 
    transaction_type, 
    status, 
    checksumhash 
FROM 
    tb_second_wallet_transactions 
WHERE id = 1

There is also a column name type in tb_first_wallet_transaction that can be 0 or 1, that I also needs to add, but the problem is that there is no such column in the second table.

One solution is that I run a query which changes does type == 1 after a certain time stamp (i.e of the insertion time of above query)

But I want to do all the insertion in one single query. Is that possible ??

Aucun commentaire:

Enregistrer un commentaire