Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Queries

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 03-12-2010, 06:31 AM
stodd stodd is offline Windows Vista Access 2007 (version 12.0)
Novice
 
Join Date: Mar 2010
Posts: 1
stodd is on a distinguished road
Default 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
Reply With Quote
  #2  
Old 03-13-2010, 10:51 PM
ConneXionLost's Avatar
ConneXionLost ConneXionLost is offline Windows XP Access 2003 (version 11.0)
Simulacrum
 
Join Date: Jan 2010
Location: Victoria, Canada
Posts: 179
ConneXionLost is on a distinguished road
Default

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,
__________________
Docendo discimus.

Please:
  • Use code tags. Place your code between [CODE] and [/CODE] tags.
  • Don't cross post. But if you feel you must, please do so Politely.
  • Clean up when you're done. Mark your thread Solved if you received your answer.
  • Thank those who helped you. Click the scales icon (Reputation) in the upper right corner of the contributor's post.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change as per condition font color miziri Programming 1 08-20-2009 02:23 AM
hours + condition Miriam Queries 0 08-09-2009 04:46 AM
Using a form to apply a condition to a Query JeepWidow Forms 0 12-22-2008 07:29 AM
How to use IIF condition nshaikh Queries 4 09-11-2008 11:23 PM
inserting values in column based another column wasim_sono Database Design 1 06-27-2006 03:23 AM


All times are GMT -8. The time now is 08:21 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.