Re: SQL question -- sampling
Posted in 1994
Ron Whiteleather — — source: Informix-list mailing list archive (1991-1998)
Todd A Wallace (twallace@mason1.gmu.edu) wrote: : I am trying to write an SQL statement that returns some fraction of all : the rows it would normally return. For instance, : : SELECT firstname, lastname, city, state : FROM bigdatabase : WHERE state = "TX" : To return _approximately_ a fraction of the rows, try adding: AND rowid=(trunc(rowid/x)*x) where x is the 1/x fraction of rows you want returned. Again, this gives only an approximate fraction of rows and is dependent on how uniformly the data is physically distributed within the table. It does NOT guarantee any randomness.