• asm1212 (8/6/2012)


    I apologize, I forgot the formatting does not reflect how it was typed in the message...

    I remember now that you have to create custom code to reflect what I am asking and it makes it easier for yall to understand ... Unfortunately, I am on a time constraint and dont have time to go through all that so I apologize and will just try to keep working with what i have and see if i can come up with what I am needing...

    try this...btw I have the same constraints

    USE [tempdb]

    GO

    IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tst_InvoiceHeader]') AND type in (N'U'))

    DROP TABLE [dbo].[tst_InvoiceHeader]

    GO

    CREATE TABLE [dbo].[tst_InvoiceHeader](

    [invoice_id] [int] NULL,

    [grouo_id] [int] NULL,

    [subscriber_id] [int] NULL,

    [duedate] [datetime] NULL

    ) ON [PRIMARY]

    GO

    INSERT INTO [dbo].[tst_InvoiceHeader]([invoice_id], [grouo_id], [subscriber_id], [duedate])

    SELECT 101, 4, 22222, '20120131 00:00:00.000' UNION ALL

    SELECT 102, 4, 22222, '20120131 00:00:00.000' UNION ALL

    SELECT 103, 5, 33333, '20120115 00:00:00.000'

    select * from tst_InvoiceHeader

    SELECT MAX(invoice_id) AS MaxId

    FROM tst_InvoiceHeader

    GROUP BY grouo_id, subscriber_id, duedate

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day