You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is generally simpler to handle an insert like this with a nested SQL sub-query (i.e. when you need to query something in order to insert another thing). You could avoid having to make a separate SELECTbefore you run the INSERT:
INSERT INTO products(name, title, product_type, description, price, seller_id) VALUES (
'abc',
'def',
'trousers',
'jkadfjkdf',
'10',
(SELECT id FROM devpop_users WHERE name ='oli')
) RETURNING id, name, seller_id;
The text was updated successfully, but these errors were encountered:
week3-auth-team2/database/model.js
Lines 26 to 30 in 8ba8bde
It is generally simpler to handle an insert like this with a nested SQL sub-query (i.e. when you need to query something in order to insert another thing). You could avoid having to make a separate
SELECT
before you run theINSERT
:The text was updated successfully, but these errors were encountered: