|
#1
|
|||
|
|||
|
Sub query question
I have am trying to write a subqueriy.I have three columns, Column A has a code like break, lunch the other two columns have a date and time. I am trying to do a sub query so I can group by column A times and count how many. Then do the same with column 2 in the same query. I can do it in seperate querys but not in a sub query or is thier an eaiers way here is my code.
Code:
SELECT Count(nettalley.STATE_CODE_1), Nettalley.STATE_CODE_1 FROM Nettalley WHERE FormatDateTime([nettalley.STATE_TIME_1],4)="00:00" GROUP BY Nettalley.STATE_CODE_1; |
|
#2
|
||||
|
||||
|
Would this work for you?
Code:
SELECT COUNT("COLA") AS COL_A_TOTAL, COUNT("COLB") AS COL_B_TOTAL
FROM tablename
WHERE 'whatever'
AND 'whatever_else'
GROUP BY COLA, COLB
__________________
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section. ![]() Please use [Code]your code goes in here[/Code] tags when posting code. Before posting your question, did you look here? Got a question on Linux? Visit our Linux sister site. Modifications Required For VB6 Apps To Work On Vista ![]() Microsoft MVP 2005/2006/2007/2008/2009 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Simple sql query for recordset | awyeah | Database | 1 | 07-13-2008 12:35 PM |
| Union query | peljo | Database | 4 | 12-17-2007 12:38 PM |
| Multi-table Select Query using Joins | knightsg | Database | 0 | 02-16-2005 09:07 AM |
| IF I NEVER DO A QUERY WITH A DATE AGAIN IT'LL BE TOO SOON!! | Macca | VB Classic | 8 | 08-09-2002 09:00 AM |
| Query Question | Shawn M | Database | 4 | 11-03-2000 12:30 PM |