Saturday, 14 September 2013

SQL To Select Records based on different values of a single column

SQL To Select Records based on different values of a single column

Table
Que_id | question | isPicture | cat_det_id
1 Where are U? 1 27
2 Hello 0 22
3 Hey 1 31
4 What is Dis? 1 27 .. . . ........ .. .... ... ........... . ... Given
the table in the picture as sample, I want select different number records
based on different values of cat_det_id.
For Instance to select 5 records that has cat_det_id of 27, 10 Records
that has cat_det_id of 31 and 7 records that has cat_det_id of 22
and these records will be presented as a records set ordered by this same
cat_det_id in ascending order.
Thank you.

No comments:

Post a Comment