id1 | id2 | v1 | v2 | v3 |
---|---|---|---|---|
P1 | I1 | A | B | C |
P1 | I2 | D | E | F |
P2 | I1 | A | B | D |
P3 | I1 | A | D | E |
P2 | I2 | B | D | E |
I need all entries with an A:
SELECT * FROM test_table WHERE v1 = 'A' OR v2 = 'A' OR v3 = 'A'
id1 | id2 | v1 | v2 | v3 |
---|---|---|---|---|
P1 | I1 | A | B | C |
P2 | I1 | A | B | D |
P3 | I1 | A | D | E |
But how can I store it?
save as X
??
CodePudding user response:
you can directly create new table and put the query as insert data.
Try this:
create table new_table SELECT * FROM test_table WHERE v1 = 'A' OR v2 = 'A' OR v3 = 'A'
CodePudding user response:
Try this
SELECT * into x FROM test_table WHERE v1 = 'A' OR v2 = 'A' OR v3 = 'A'