Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with functions

Status
Not open for further replies.

dwhalen

Programmer
Feb 22, 2002
105
CA
Hello this is my SQL statement:
SELECT date_trunc('minute',AVG(AGE(t.close_date,t.creation_date))) AS TimeFrame, COUNT(t.task_id) , t.assigned_id AS Asignee, w.client_id AS Organization FROM task AS t,workbasket AS w WHERE t.location_name iLIKE 'Sales%'|| '|' || 'Create Work Order%' AND t.assigned_id='organ' AND w.client_id iLIKE '100-%' AND w.task_id = t.task_id GROUP BY t.assigned_id, w.client_id

I am not getting a value for the first select. The problem is or at least I think, is that there is only one value in the database that fits the requirements, so I am thinking that running AVG on just one value returns nothing. Am I wrong? If I am right how can I get around this, any suggestions.

Thanks
 
Disregard this question, I figured it out myself, it had nothing to do with the AVG function not working on 1 value, it was my SQL....go figure....I was using the wrong primary key.

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top