![]() |
|
|
#1
|
|||
|
|||
|
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
|
||||
|
||||
|
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;
__________________
Docendo discimus. Please:
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
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 |