on 11-07-2019 10:31 AM
I’ve got a table “Case” with 3 million records.
I want to Divide the table randomly into two equal views: “view_1” and “view_2”.
first view is created with no problems, but the second has 0 record. Can anyone help with the second view?
Create view “view_1” as
(select * from “Case” where rand() < 0.50);
Create view “view_2” as
(select * from “Case” as t1
left join “view_1” as t2 on
t1.* = t2.* where t1.* is null);
Hello Liz,
what about a minus-function for your second view like ...
Create view “view_2” as
(select * from “Case” as t1
minus
select * from "view_1");
This would in my opinion generate the difference between your origin table and the generated view_1 as view_2.
Regards
Markus
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.