Results 1 to 2 of 2
  1. #1
    stodd is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Posts
    1

    Like condition for 1 column help pls!

    Hello everyone!

    I have access database and i'm trying to make a query using the like condition in it. I've added 1 column 2 time in the query and i'm trying to use the like condition to pull 2 different things.

    In this column are just 1 Letter A, B, C, D, E. There are locations linked to each letter in a different column of the database. The first thing I'm trying to get with the like condition from the column is the letter "E". Then i've added that same column in the query again and want to pull everything that has the letter C in the column. And i need the data to output in that column only. But what it is doing for me is putting the data for the "E" and the "C" in the same column after i do the query.

    I need the output to be in the first column the location, then second column I need to the show the letter "E" (but count that and show me a number of times it comes up with that letter for that location) and then same thing for letter "C" in the third column ( but count this one too and show me a number). So when its done ill have 3 columns of information 1 listing the locations, 1 listing letter "E" numbers and 1 listing letter "C" numbers.

    If anyone out there can help me with this problem i'm having that would be great! I'm getting heat from my bosses to get this data.

    Thank you so much!
    Shane

  2. #2
    ConneXionLost's Avatar
    ConneXionLost is offline Simulacrum
    Windows XP Access 2003
    Join Date
    Jan 2010
    Location
    Victoria, Canada
    Posts
    291
    Hi stodd,

    You did not provide a source table or field names so it is a little difficult to provide an answer, but this might help:

    Code:
    SELECT yourtable.Location, Sum(IIf([lettercolumn]="C",1,0)) AS CCount, Sum(IIf([lettercolumn]="E",1,0)) AS ECount
    FROM yourtable
    GROUP BY yourtable.Location;
    Cheers,

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Change as per condition font color
    By miziri in forum Programming
    Replies: 1
    Last Post: 08-20-2009, 04:23 AM
  2. hours + condition
    By Miriam in forum Queries
    Replies: 0
    Last Post: 08-09-2009, 06:46 AM
  3. Using a form to apply a condition to a Query
    By JeepWidow in forum Forms
    Replies: 0
    Last Post: 12-22-2008, 10:29 AM
  4. How to use IIF condition
    By nshaikh in forum Queries
    Replies: 4
    Last Post: 09-12-2008, 01:23 AM
  5. inserting values in column based another column
    By wasim_sono in forum Database Design
    Replies: 1
    Last Post: 06-27-2006, 05:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums