|
Post by sussifix on Sept 19, 2018 15:58:09 GMT
Hello!
I can't figure it out. The FAQs showing lists, but never only one value. Maybe I am thinking in the wrong way.
1. Select one
For example I have a Table with Id; A; B; C; I would like to have the Id, when I know a specific value under A
Like: string x = SELECT Id FROM Table WHERE A = something or int y = SELECT Id FROM Table WHERE A = something
Short: I would like to have a selection from a specific value from a specific table and put it in variable.
2. Copy
Is it possible, to copy values from one table to another? In the internet they say isnt possible with sqlite (Innerjoin).
For example I have Table1 with Id; A; B; C; and another Table2 with Id; D; E; C;
Now i would like to copy something from Table2 to Table1 like:
SELECT * FROM Table2 INNERJOIN Table1 WHERE id = 2
Short: I would like to copy from one table to another, where the a specific value is the same.
I hope is understandable what I want to do. Thanks!
|
|
|
Post by echo17 on Sept 19, 2018 16:48:17 GMT
Hello! Short: I would like to have a selection from a specific value from a specific table and put it in variable. Check out this FAQ: linkIs it possible, to copy values from one table to another? In the internet they say isnt possible with sqlite (Innerjoin). You could do something like: var sql = "INSERT INTO Table1 (A, B, C) SELECT D, E, C FROM Table2 WHERE Id = ?"
dbManager.Execute(sql, 36);
Where the id you are trying to copy from Table 2 is 36. Assuming your Id fields are autoincremented and you don't need to specify them explicitly for insertion. Check out this StackOverflow post: link
|
|
|
Post by sussifix on Sept 19, 2018 17:52:21 GMT
Super, it works. Weird that I didn't see this in the FAQ. I saw only the Query or QueryFirstRecord. The second part of it works fine for me.
Thanks!
|
|