0

I have numerical data ​​related to clinical information from people with a particular disease recorded in an specific column ('Lab') from Table A.

I need to get a Table B with 30 rows and 50 columns.

The columns of Table B should be random samples from the values ​​contained in column 'Lab' (nearly 3300 registers).

I am able to get a table with one column using:

SELECT Lab FROM Table_A sample (1) WHERE Lab IS NOT NULL;

Is it possible make a query using the SELECT command that results in Table B with all its 50 columns without the need of getting its columns one by one?

msrd0
  • 7,816
  • 9
  • 47
  • 82
Paulo
  • 1
  • Let me see if I understand your question correctly: table `A` has 3300 rows, each has column called `Lab`; you want to create table `B` with 1500 values from `A.Lab`, drawn at random and organized into a 30x50 matrix? Also what vendor are you using, SQL Server, Oracle, MySQL? – Code Different Sep 11 '14 at 16:00

1 Answers1

-1

You can use the RAND operator with ORDER BY, like this:

SELECT * FROM Table_A ORDER BY RAND( ) LIMIT 0 , 30
msrd0
  • 7,816
  • 9
  • 47
  • 82
Amine Horseman
  • 162
  • 1
  • 12