Top DevX Stories
Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Search the forums:
  #1  
Old 11-05-2009, 11:48 AM
landslide landslide is offline
Registered User
 
Join Date: Mar 2007
Posts: 61
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;
Reply With Quote
  #2  
Old 11-05-2009, 01:12 PM
Hack's Avatar
Hack Hack is offline
Super Moderator
 
Join Date: Apr 2007
Location: Sterling Heights, Michigan
Posts: 7,719
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
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 Off
HTML code is Off
Forum Jump

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


All times are GMT -4. The time now is 11:35 PM.


Sponsored Links



Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.