Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. eerlee

    Insert count from 2 queries

    INSERT INTO TBLCOUNT (CurrDate,Count1,Count2) VALUES(DATE(),(SELECT COUNT(*) FROM Query1),(SELECT COUNT(*) FROM Query2))
  2. eerlee

    Query for Top N for large amount of data

    hi, try this SELECT SalesPerson, State, SUM(Cost) AS TotalSales FROM Invoice I WHERE SalesPerson IN (SELECT TOP 5 SalesPerson FROM Invoice WHERE State=I.State GROUP BY SalesPerson ORDER BY SUM(Cost) DESC) GROUP BY SalesPerson, State
  3. eerlee

    Select last 15 records

    hi Do you need the last 15 records ordered by TXCLIPS.ID2 DESC? If so, then order it by ASC then get the top 15. SELECT * FROM ( SELECT TOP 15 TXMASTERS.ID1, TXCLIPS.ID2, " " AS Persons, TXCLIPS.NName AS Name, TXCLIPS.Comments, TXCLIPS.Start AS [Time In], TXCLIPS.End AS [Time Out], TXCLIPS.ID1...
  4. eerlee

    Querying for Lowest Date out of Duplicate records

    oops, didn't notice you wanted the min date. SELECT * FROM Orders O WHERE OrderDate = (SELECT MIN(OrderDate) FROM Orders WHERE OrderNo=O.OrderNo)
  5. eerlee

    Querying for Lowest Date out of Duplicate records

    SELECT * FROM Orders O WHERE OrderDate = (SELECT Max(OrderDate) FROM Orders WHERE OrderNo=O.OrderNo)
  6. eerlee

    CASE expression?

    hi, this should do it. SELECT Transaction_ID ,SUM(CASE WHEN Tran_Breakdown_ID = 'Net' THEN Amount ELSE 0 END) AS Net ,SUM(CASE WHEN Tran_Breakdown_ID = 'Fee' THEN Amount ELSE 0 END) AS Fee ,SUM(CASE WHEN Tran_Breakdown_ID = 'Tax_IPT' THEN Amount ELSE 0 END) AS Tax_IPT...

Part and Inventory Search

Back
Top