-1

I have two sqlite tables:

user:

ID  city
--  ----
1   ankara
2   istanbul
3   ankara

action

userID  isFree
------  ------

and a query like this:

INSERT INTO action (userID, isFree) 
VALUES ( (SELECT ID FROM user WHERE city = 'ankara'), true); 

This query inserts just the first user to the action table, but I want to insert first and third users into the action table.

Are there any way to do this in a single query?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
SayMyName
  • 9
  • 5

1 Answers1

1
INSERT INTO action(userID, isFree) 
 Select ID, true from user where city='ankara'; 
hotfix
  • 3,376
  • 20
  • 36