Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2009
    Posts
    185

    Unanswered: Select count syntax

    I tried to build a query using count. What I want is to count the number of records where Flight.[battery id] a number like 2
    I want to run this in vb code onclick of a button on a form I then want to display the count in a unboudn text field.

    Please help

    SELECT Count(Flights.[iBattery ID]) AS [CountOfiBattery ID]
    FROM Flights
    HAVING (((Count(Flights.[iBattery ID]))=2));

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Code:
    SELECT COUNT(*) AS [CountOfiBattery ID]
    FROM Flights
    WHERE [CountOfiBattery ID] = 2
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by pootle flump
    Code:
    SELECT COUNT(*) AS [CountOfiBattery ID]
    FROM Flights
    WHERE [CountOfiBattery ID] = 2
    poots, wtf?

    if you are trying to make a point with your syntax error, it's far too subtle
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Code:
    SELECT COUNT(*) AS [CountOfiBattery ID]
    FROM Flights
    WHERE [iBattery ID] = 2
    No point, just an error.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Jul 2009
    Posts
    185
    Quote Originally Posted by pootle flump
    Code:
    SELECT COUNT(*) AS [CountOfiBattery ID]
    FROM Flights
    WHERE [CountOfiBattery ID] = 2
    how would I use this in vb code ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •