Results 1 to 3 of 3

Thread: Select top N

  1. #1
    Join Date
    Mar 2014

    Unanswered: Select top N

    I have an issue I need help with. I have a form that runs a query and displays how many of each device type[computer, monitor, switch etc] I currently have AVAILABLE (where STATUS = 'AVAILABLE'). I placed a textbox and a command button on the form. I want the user to enter a number (e.g 5) and when they click the command button, it should select the top n (5 in the example) of each device type (5 computers, 5 monitors, 5 switches etc) and changed the STATUS to 'NOT AVAILABLE'. Then display the devices selected. How can I accomplish this? Thanks in advance.

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    use the TOP predicate
    use a GROUP BY clause
    to get your data

    then in your command button to issue an UPDATE query which sets those items to not vailable
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Mar 2014

    Select top N

    Am not sure the GROUP BY works in this case. The data being selected is from different tables with different attributes and no relationships.

Tags for this Thread

Posting Permissions

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