clarification about query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hemashiki
    New Member
    • Aug 2006
    • 34

    #1

    clarification about query

    strSQL1 = "SELECT NAME,LDATE, OT,OTWAGES"

    strSQL1 = strSQL1 & " FROM Empolyee WHERE "

    strSQL1 = strSQL1 & " LDATE BETWEEN #" & Text1.Text & "# AND #"

    strSQL1 = strS QL1 & Text2.Text & "# ORDER BY LDATE"

    In this Empolyee table

    Name ot ldate otwages

    Alex 2 1/1/2006 10

    Alex 4 7/1/2006 34


    Herewith I tried the above coding,the result displayed as

    Name ot otwages

    Alex 2 10

    Alex 4 34

    , in the name of alex….i want to sum the field ot & towages

    I want the result as

    Name ot otwages

    Alex 6 44

    when i tried using SUM(field name) GROUP BY NAME

    it showing "sytax error in string query expression"

    can anyone suggest pls
  • sashi
    Recognized Expert Top Contributor
    • Jun 2006
    • 1749

    #2
    Hi there,

    Instead on using the "GROUP BY NAME", try using, "WHERE NAME LIKE 'Alex'. Good luck & take care my fren.. :)

    Originally posted by hemashiki
    strSQL1 = "SELECT NAME,LDATE, OT,OTWAGES"

    strSQL1 = strSQL1 & " FROM Empolyee WHERE "

    strSQL1 = strSQL1 & " LDATE BETWEEN #" & Text1.Text & "# AND #"

    strSQL1 = strS QL1 & Text2.Text & "# ORDER BY LDATE"

    In this Empolyee table

    Name ot ldate otwages

    Alex 2 1/1/2006 10

    Alex 4 7/1/2006 34


    Herewith I tried the above coding,the result displayed as

    Name ot otwages

    Alex 2 10

    Alex 4 34

    , in the name of alex….i want to sum the field ot & towages

    I want the result as

    Name ot otwages

    Alex 6 44

    when i tried using SUM(field name) GROUP BY NAME

    it showing "sytax error in string query expression"

    can anyone suggest pls

    Comment

    • hemashiki
      New Member
      • Aug 2006
      • 34

      #3
      Hi sashi
      it must b dynamic(monthly report of overall empolyees)..... .thats y i used "GROUP BY NAME",while i'm implement in data report ...it showing "the field is NOT A PART OF AGGREGATE FUNCTION"
      or showing "the field is not found"

      Comment

      Working...