Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2009
    Posts
    10

    Red face How to query comparing two field values

    What is the best way to run a query comparing the values of two fields. For example, in my inventory database, I have a quanity field and a minimum stock field. How would I run a query to see which records have less in the quantity field than in the minimum stock field and report those records only?

  2. #2
    Join Date
    May 2009
    Posts
    258
    Something similar to the following should work:
    Code:
    SELECT * FROM table_name
    WHERE qty_field<min_stock_field
    Regards,

    Ax

  3. #3
    Join Date
    Aug 2009
    Posts
    10
    Thank you, but you will have to forgive me. I don't have the foggiest idea where to plug in the code. I have only set up this database using "VERY" basic Access skills.

  4. #4
    Join Date
    Aug 2009
    Location
    Up Nort' Wi
    Posts
    140
    You can either use the query builder: Queries tab, click new, right click on the grey portion and select "SQL View". Type in the query that was offered and click the red ! to test it. It'll open a tableview list of the records that meet the criteria.
    You can also build reports to do this and use the SQL as a filter on the open report command.

    Sam, good luck
    Good, fast, cheap...Pick 2.

Posting Permissions

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