I have a very specific question regarding using SELECT DISTINCT...INTO...
I want to select exactly 1000 random rows into a new table using SELECT DISTINCT which forms combinations of rows from my previous table. For example, my current query is:
SELECT DISTINCT p1.id AS id1, p2.id AS id2 INTO my_new_table FROM oldtable AS p1, oldtable AS p2;
How do I modify this so that I am selecting at most 1000 random rows? I'm dealing with millions of records so a solution that is efficient is obviously desired.