Hi,
I have a table: user
uid status
1 1
2 1
3 1
4 2
5 2
6 1
7 2
8 1
9 3
10 2
I am trying to fetch data for below logic:
1) fetch top 6 rows having status=1
2) if status=1 has less then 6 rows then fetch remaining status 2 rows
for example:if we have only 4 rows having status 1 then remaining two rows will be having status=2 rows(rows count should be 6)
3)if status 1 has two rows only,and status=2 rows also,then remaining 2 rows will be having status=3
for example: if we have 1 row having status 1 and 3 rows having status=2 ,then te remaining rows should have status 3 (count of rows should be 6)
Need Suggestions...
jacob21 0 Posting Whiz in Training
pritaeas 2,194 ¯\_(ツ)_/¯ Moderator Featured Poster
jacob21 0 Posting Whiz in Training
pritaeas 2,194 ¯\_(ツ)_/¯ Moderator Featured Poster
jacob21 0 Posting Whiz in Training
pritaeas 2,194 ¯\_(ツ)_/¯ Moderator Featured Poster
jacob21 0 Posting Whiz in Training
pritaeas 2,194 ¯\_(ツ)_/¯ Moderator Featured Poster
jacob21 0 Posting Whiz in Training
pritaeas 2,194 ¯\_(ツ)_/¯ Moderator Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.