Click here to Skip to main content
15,922,584 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI friends I write the query Like This...
SQL
SELECT Subjects.SubName,DayTable.DayName FROM ClassRoom INNER JOIN Cst ON ClassRoom.ClassId = Cst.ClassId INNER JOIN newTimeTable ON Cst.CstId = newTimeTable.CstId INNER JOIN ClassHours ON newTimeTable.HourId = ClassHours.HourId INNER JOIN Subjects ON Cst.SubjectId = Subjects.SubjectId INNER JOIN DayTable ON newTimeTable.DayId = DayTable.DayId where HourName='5th Hour' and ClassName='1st Class' ORDER BY DayTable.DayName


I have a problem with this..
When I Use this query it fetches the records from DayNames Based On(FriDay,MonDay,TueDay....) But I want(Monday,TesDay,WedDay...)In this form Anyone pls help me....
Posted

You have to define 'DayNo' in your database and then sort based on it to get the result you desire.

In your DatTable, define 'DayNo' column. Put 1,2,3...,6,7 as per you need (Sunday starting day or Monday starting day). Now, in your query, fetch the data as per your need (same as above) but just change the ORDER BY clause and sort based on this new 'DayNo' column.
 
Share this answer
 
ORDER BY DayTable.DayId should do the trick (I hope that your DayId is sorted in a useful way...).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900