Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

need help with query

 
   Database Help (Home) -> Programming RSS
Next:  funny search results with 'contains' clause  
Author Message
TJS

External


Since: Oct 05, 2003
Posts: 9



(Msg. 1) Posted: Wed Feb 23, 2005 2:17 am
Post subject: need help with query
Archived from groups: microsoft>public>sqlserver>programming (more info?)

I want to sum the records in a table (u) which have 'P.M.' in a field value
and test against a fixed limit

something to the effect of :

case
when SUM(substring(u.sTime,1,4)='P.M.') <= 64 Then ....

except it should work Smile

any suggestions would be appreciated

TIA

 >> Stay informed about: need help with query 
Back to top
Login to vote
thomasroji

External


Since: Nov 11, 2004
Posts: 33



(Msg. 2) Posted: Wed Feb 23, 2005 5:40 am
Post subject: Re: need help with query [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Try something like

SELECT Type
FROM Titles
GROUP By type
HAVING SUM(CASE WHEN type='business' Then price Else 0 End) < 50

--
Roji. P. Thomas
Net Asset Management
<a rel="nofollow" style='text-decoration: none;' href="https://www.netassetmanagement.com" target="_blank">https://www.netassetmanagement.com</a>


"TJS" wrote in message

 >I want to sum the records in a table (u) which have 'P.M.' in a field value
 >and test against a fixed limit
 >
 > something to the effect of :
 >
 > case
 > when SUM(substring(u.sTime,1,4)='P.M.') <= 64 Then ....
 >
 > except it should work Smile
 >
 > any suggestions would be appreciated
 >
 > TIA
 >

 >> Stay informed about: need help with query 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
EXISTS Query vs Sub Query - Hi Group, I have the following query, but I need to add a column from another table in the resultset. No matter what I do I end up with what seems like a cartesian product. I want the same number of records that this query gives me but just with the...

query that creates column names, uses column names for que.. - I would like to get an output like this but chagnes the () names to actual dates: (last Friday) (two Fridays ago) (three Fridays ago) ... (12 Friday's ago) new 10 6 1 resolved 0 ...

XML Query - Hi This is an easy Qn. Just send me where did i go wrong ? DECLARE @HDoc int DECLARE @xmlDoc nvarchar(4000) SET @XMLDoc = '<XML><Functionality><F>1</F><R>10</R><F>2</F><R>20</R></Functionali...

Query Help - Im trying to write a query that will return the next daily sub number and Volume number for our submissions. the volume number is easy as it is incremented each time, but the Daily sub number needs to be reset each day. Each time a submission is mad...

Max() and Query... - Hi i got the following problem... i got a Table with multiple Scores for People..... Something Like This ID NAME POINTS 1 JOE 15 2 JOE 20 3 CHRIS 19 4 MATT 40 5 CHRIS 1 6 ....
   Database Help (Home) -> Programming All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]