Click here to Skip to main content
15,914,447 members
Home / Discussions / Database
   

Database

 
GeneralRe: SQL Float Rounding... or something :-) Pin
MatthysDT30-Jul-07 21:36
MatthysDT30-Jul-07 21:36 
GeneralRe: SQL Float Rounding... or something :-) Pin
Colin Angus Mackay30-Jul-07 22:45
Colin Angus Mackay30-Jul-07 22:45 
GeneralRe: SQL Float Rounding... or something :-) Pin
Pete O'Hanlon31-Jul-07 10:16
mvePete O'Hanlon31-Jul-07 10:16 
QuestionQuery Of This Request? Pin
mehrdadc4829-Jul-07 23:12
mehrdadc4829-Jul-07 23:12 
AnswerRe: Query Of This Request? Pin
gauthee29-Jul-07 23:17
gauthee29-Jul-07 23:17 
AnswerRe: Query Of This Request? Pin
Sam Heller30-Jul-07 12:03
Sam Heller30-Jul-07 12:03 
QuestionRanks in FUll Text Search Pin
Brendan Vogt29-Jul-07 21:58
Brendan Vogt29-Jul-07 21:58 
Question(Urgent Need Plz hlp me)Group by & order by in Stored procedure..., [modified] Pin
Member 387988129-Jul-07 18:48
Member 387988129-Jul-07 18:48 
CREATE PROCEDURE salary2
(
@projectid as int,
@months as tinyint,
@years as smallint,
@Insunday as smallint,
@Outsunday as smallint
)
As
declare
@countinstall as smallint
begin

select a.empid,b.empName,c.Whrs,c.Bassalary,c.hra,c.ca,c.ota,C.ot,c.Esi,c.srg,
case when (isnull(srg,0))=0 then @Outsunday else @Insunday end as days,c.Edate
from tblMonthHourDetails a,tblemployeemaster b,tblsalarydetails c where a.empid=b.empid and a.empid=c.empid and
b.projectid=@projectid and datepart(mm,[SDate])=@months and datepart(yy,[SDate])=@Years
group by a.empid,b.empName,c.Whrs,c.srg,c.Edate

end
GO


Hi in this stored procedure working...,
But The same tblsalarydeatils empid have more than one record...,
So i like to take the final entry record from that tblsalarydeatils empid based on the edate field...,
So, i have to use Order by desc method...,
The query should like this format(For example taken a paticular empid):
Select top 1 * from tblmonthsalarydetails where empid=608 order by edate desc

But see in my procedure i already used group by...,
So how to say in that, for the empid take latest record like?,
Means how to use there " order by edate desc"...,
Plz any one hlp me...,
Or give some solution for this probs,
Advance Thanks,


-- modified at 2:35 Monday 30th July, 2007


-- modified at 2:38 Monday 30th July, 2007


-- modified at 2:39 Monday 30th July, 2007

Regards,
Magi

AnswerRe: (Urgent Need Plz hlp me)Group by & order by in Stored procedure..., Pin
gauthee29-Jul-07 21:12
gauthee29-Jul-07 21:12 
GeneralRe: (Urgent Need Plz hlp me)Group by & order by in Stored procedure..., Pin
Member 387988129-Jul-07 22:01
Member 387988129-Jul-07 22:01 
GeneralRe: (Urgent Need Plz hlp me)Group by & order by in Stored procedure..., Pin
gauthee29-Jul-07 23:01
gauthee29-Jul-07 23:01 
GeneralRe: (Urgent Need Plz hlp me)Group by & order by in Stored procedure..., Pin
Member 387988129-Jul-07 23:18
Member 387988129-Jul-07 23:18 
GeneralRe: (Urgent Need Plz hlp me)Group by & order by in Stored procedure..., Pin
gauthee29-Jul-07 23:23
gauthee29-Jul-07 23:23 
GeneralRe: (Urgent Need Plz hlp me)Group by & order by in Stored procedure..., Pin
Member 387988130-Jul-07 3:16
Member 387988130-Jul-07 3:16 
AnswerStop with the 'urgent' Pin
leckey30-Jul-07 3:22
leckey30-Jul-07 3:22 
QuestionSQL Server Licesning Pin
thedom229-Jul-07 15:29
thedom229-Jul-07 15:29 
AnswerRe: SQL Server Licesning Pin
Paul Conrad29-Jul-07 19:47
professionalPaul Conrad29-Jul-07 19:47 
AnswerRe: SQL Server Licesning Pin
originSH30-Jul-07 3:32
originSH30-Jul-07 3:32 
AnswerRe: SQL Server Licesning Pin
Rob Graham30-Jul-07 4:50
Rob Graham30-Jul-07 4:50 
QuestionRetrieving data from database (context: ASP.Net) Pin
h@$@n29-Jul-07 7:57
h@$@n29-Jul-07 7:57 
AnswerRe: Retrieving data from database (context: ASP.Net) Pin
mr.mohsen29-Jul-07 11:16
mr.mohsen29-Jul-07 11:16 
QuestionHow to convert Sql server 2000 database backup file to Sql server 2005 Express Edition .mdf file. Pin
Paramhans Dubey29-Jul-07 5:28
professionalParamhans Dubey29-Jul-07 5:28 
AnswerRe: How to convert Sql server 2000 database backup file to Sql server 2005 Express Edition .mdf file. Pin
Paul Conrad29-Jul-07 8:56
professionalPaul Conrad29-Jul-07 8:56 
AnswerRe: How to convert Sql server 2000 database backup file to Sql server 2005 Express Edition .mdf file. Pin
Mike Dimmick30-Jul-07 12:15
Mike Dimmick30-Jul-07 12:15 
GeneralRe: How to convert Sql server 2000 database backup file to Sql server 2005 Express Edition .mdf file. Pin
Paramhans Dubey31-Jul-07 2:09
professionalParamhans Dubey31-Jul-07 2:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.