vendredi 15 juillet 2016

i want to select random 24 rows from table but this Query doesn't works for me

i want to select 24 Random rows from whole table of Admin_Pic_Lib but This Query give syntax error

 SELECT top 24 CAST( [Pictures] AS varbinary(Max)) FROM Admin_Pic_Lib ORDER BY NEWID()

 UNION ALL 

  SELECT  CAST([Pictures] AS varbinary(Max))   FROM User_images  WHERE UserName ='ahmed'

when i m am trimming ORDER BY NEWID() it only select top 24 rows




Aucun commentaire:

Enregistrer un commentaire