Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)

  • RE: Select Unique Foreign Key Rows

    SELECT * FROM Formum_Child a INNER JOIN

     (SELECT pid, MAX(DateSubmitted) DateSubmitted FROM Forum_Child GROUP BY pid) b

     ON a.pid=b.pid AND a.DateSubmitted=b.DateSubmitted

  • RE: Query for calculating sum of negative and +ive value.

    SELECT Customer, SUM(InvoiceAmt) TotalSales, COUNT(Invoice) NoOfInvoices, Month, SUM(CreditNoteAmt) TotalCreditNote,

     COUNT(CreditNote) NoOfCreditNotes

    FROM

    (SELECT NBillingF.Customer,

     CASE WHEN NBillingF.InvoicedValue > 0 THEN NBillingF.InvoicedValue ELSE 0 END AS InvoiceAmt,

     CASE WHEN NBillingF.InvoicedValue > 0...

  • RE: Join query (How to join to tables)

    select d.DepartmentName, e.*

    from Department d

    join Employee e on e.DepartmentId = d.DepartmentId

Viewing 3 posts - 1 through 3 (of 3 total)