I want to fetch 3 rows
data from class
table who is belongs to class 5,6 and 7
last row only.
Right now I'm using 3 sql
queries to fetch data:
1. SELECT * from class where class_name = '5';
2. SELECT * from class where class_name = '6';
3. SELECT * from class where class_name = '7';
How can I use single sql query to retrieve 3 row data instead of 3 sql queries ?
**class table structure:**
|id | class_name | student |
|---| -----------| ---------|
|1 | 5 | Student A|
|2 | 6 | Student B|
|3 | 4 | Student C|
|4 | 6 | Student D|
|5 | 7 | Student E|
|6 | 5 | Student F|
|7 | 4 | Student G|
|8 | 6 | Student H|
|9 | 5 | Student I|
|10 | 6 | Student J|
|11 | 7 | Student K|
|12 | 6 | Student L|
|13 | 8 | Student M|
|14 | 6 | Student N|
|15 | 8 | Student O|
Result required: Student I,Student N and Student K