Click here to Skip to main content
15,902,275 members
Home / Discussions / Database
   

Database

 
GeneralServer link Pin
Anonymous17-Oct-03 4:55
Anonymous17-Oct-03 4:55 
GeneralRe: Server link Pin
Colin Angus Mackay17-Oct-03 6:21
Colin Angus Mackay17-Oct-03 6:21 
GeneralVB.NET datagrid Pin
Anonymous16-Oct-03 12:30
Anonymous16-Oct-03 12:30 
GeneralRe: VB.NET datagrid Pin
Edbert P16-Oct-03 20:15
Edbert P16-Oct-03 20:15 
GeneralADO+"Update"+RecordsAffected+"VC++" Pin
DaviziN16-Oct-03 5:31
DaviziN16-Oct-03 5:31 
GeneralRe: ADO+"Update"+RecordsAffected+"VC++" Pin
DaviziN16-Oct-03 21:37
DaviziN16-Oct-03 21:37 
GeneralSome SQL problem in displaying data Pin
erbest15-Oct-03 22:20
erbest15-Oct-03 22:20 
GeneralRe: Some SQL problem in displaying data Pin
andyharman20-Oct-03 12:14
professionalandyharman20-Oct-03 12:14 
If you are using SQL-Server then one way would be:
create procedure RepProjHours<br />
as begin<br />
  set nocount on<br />
<br />
  --Create temporary table with line-number.<br />
  create table #temp1 (<br />
    LineNo integer identity not null,<br />
    LogDate datetime null,<br />
    ProjCode varchar(3) null,<br />
    Hrs decimal(6,2) null<br />
    )<br />
  insert into #temp1<br />
    select LogDate, ProjCode, Hrs<br />
    from MyTimesheetTable<br />
    order by LogDate, ProjCode, Hrs desc  --Nice ordering?<br />
<br />
  --Find the first timesheet entry for each day.<br />
  create table #temp2 (<br />
    LogDate datetime null,<br />
    MinLineNo integer not null,<br />
    TotalHrs decimal(6,2) not null<br />
    )<br />
  insert into #temp2<br />
    select LogDate, Min(LineNo), Sum(Hrs)<br />
    from #temp1<br />
    group by LogDate<br />
<br />
  --Join everything together (with subtotal on first line for each date).<br />
  select T1.LogDate, T1.ProjCode, T1.Hrs, T2.TotalHrs<br />
    from #temp1 T1<br />
    left outer join #temp2 T2<br />
      on T2.LogDate = T1.LogDate<br />
      and T2.MinLineNo = T1.LineNo<br />
    order by T1.LineNo<br />
end


Hope this helps. There are several other ways of achieving the same effect).
Andy
GeneralALTER TABLE ALTER COLUMN IDENTITY,help me Pin
crodling15-Oct-03 21:52
crodling15-Oct-03 21:52 
GeneralRe: ALTER TABLE ALTER COLUMN IDENTITY,help me Pin
Mike Dimmick16-Oct-03 5:03
Mike Dimmick16-Oct-03 5:03 
GeneralRe: ALTER TABLE ALTER COLUMN IDENTITY,help me Pin
Anonymous19-Oct-03 14:55
Anonymous19-Oct-03 14:55 
GeneralHighlighting a datagrid row based on condition Pin
Anonymous15-Oct-03 14:49
Anonymous15-Oct-03 14:49 
GeneralLoooping through SELECT values in SQL Pin
mittalpa15-Oct-03 10:59
mittalpa15-Oct-03 10:59 
GeneralRe: Loooping through SELECT values in SQL Pin
Mike Dimmick16-Oct-03 5:14
Mike Dimmick16-Oct-03 5:14 
GeneralRe: Loooping through SELECT values in SQL Pin
Arjan Einbu18-Oct-03 9:44
Arjan Einbu18-Oct-03 9:44 
GeneralRe: Loooping through SELECT values in SQL Pin
mittalpa20-Oct-03 10:09
mittalpa20-Oct-03 10:09 
GeneralHelp! Test of SQL Server's scalability Pin
yyf15-Oct-03 10:34
yyf15-Oct-03 10:34 
GeneralRe: Help! Test of SQL Server's scalability Pin
Guillermo Rivero15-Oct-03 13:21
Guillermo Rivero15-Oct-03 13:21 
GeneralRe: Help! Test of SQL Server's scalability Pin
yyf16-Oct-03 3:22
yyf16-Oct-03 3:22 
GeneralQuery Pin
Anonymous15-Oct-03 6:36
Anonymous15-Oct-03 6:36 
GeneralMSAccess system tables & ADO.NET Pin
Armen Dalaliants15-Oct-03 6:28
Armen Dalaliants15-Oct-03 6:28 
GeneralImport Stored Procedure Pin
Richard Hudson15-Oct-03 5:19
Richard Hudson15-Oct-03 5:19 
GeneralRe: Import Stored Procedure Pin
Mike Dimmick16-Oct-03 5:08
Mike Dimmick16-Oct-03 5:08 
Generalforeign key Pin
Anonymous15-Oct-03 4:32
Anonymous15-Oct-03 4:32 
GeneralKill Sleeping Database Connections in SQL Server Pin
Altafqau15-Oct-03 0:17
Altafqau15-Oct-03 0:17 

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.