I have three tables
i have logged in the student..
den i run this query
select distinct sem_no from course,student_info where course.c_id=student_info.c_id and s_id='0001' order by sem_no;
it shows all the semster he passed inclueding the running semster..
now i want to show the last value of sem_no coloumn as his current semster..
how can i grab the last value of the sem_no???
SELECT MAX(COURSE.SEM_NO) FROM COURSE, STUDENT_INFO
You can try the below SQL Query
select top 1 sem_no from course, student_info
order by sem_no desc
have a good day :)