DB2 Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDB2 Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old March 16th, 2007, 09:08 AM
o0MattE0o's Avatar
o0MattE0o o0MattE0o is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2005
Location: West London
Posts: 257 o0MattE0o User rank is Corporal (100 - 500 Reputation Level)o0MattE0o User rank is Corporal (100 - 500 Reputation Level)o0MattE0o User rank is Corporal (100 - 500 Reputation Level)o0MattE0o User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 23 h 58 m 55 sec
Reputation Power: 4
Send a message via MSN to o0MattE0o
DBxtra (Urgent Help)

Right lets see if I can explain this I am using DBxtra and have 8 tables of data: -
SERV_CALL_AUDIT
SERV_CALL_1
SERV_CALL_2
SERV_SITE_2
SERV_SITE_EQ_2
SALES_ACC_DETAIL_1
SERV_CONTRACT_1
SERV_FAULT

I need to count the 'SERV_CALL_1.SERVICE_JOB_NUMBER' but I only want to count the ones that have got '04%' at the start of every word in 'SERV_CALL_AUDIT"."DETAILS'. the code below shows this correct when I dont use the count but when I do I get more job numbers than I want.

Yes there are for example 2 job numbers but there the same number so it should count as 1 not 2.

Code:
SELECT 
      "SERV_CALL_1"."SERVICE_JOB_NUMBER", "SALES_ACC_DETAIL_1"."CUST_NAME", "SERV_CONTRACT_1"."CUSTOMER_REF", "SERV_FAULT"."SERV_FAULT_DESC", Min("SERV_CALL_AUDIT"."DETAILS") AS "MIN of DETAILS"
   FROM 
      "root"."SERV_CALL_1" "SERV_CALL_1","root"."SERV_CALL_2" "SERV_CALL_2","root"."SERV_SITE_2" "SERV_SITE_2","root"."SALES_ACC_DETAIL_1" "SALES_ACC_DETAIL_1","root"."SERV_SITE_EQ_2" "SERV_SITE_EQ_2","root"."SERV_CONTRACT_1" "SERV_CONTRACT_1","root"."SERV_FAULT" "SERV_FAULT","intadm"."SERV_CALL_AUDIT" "SERV_CALL_AUDIT"
   WHERE 
      ("SERV_CALL_1"."SERV_SITE"="SERV_CALL_2"."SERV_SITE" AND "SERV_CALL_1"."CALL_NUMBER"="SERV_CALL_2"."CALL_NUMBER" AND "SERV_CALL_1"."SERV_SITE"="SERV_SITE_2"."SERV_SITE" AND "SERV_SITE_2"."CUST_CODE"="SALES_ACC_DETAIL_1"."CUST_CODE" AND "SERV_CALL_1"."SERV_SITE"="SERV_SITE_EQ_2"."SERV_SITE" AND "SERV_CALL_1"."SERV_ITEM_NUMBER"="SERV_SITE_EQ_2"."SERV_ITEM_NUMBER" AND "SERV_SITE_EQ_2"."SERV_CONTRACT"="SERV_CONTRACT_1"."SERV_CONTRACT" AND "SERV_CALL_2"."SERV_FAULT_CODE"="SERV_FAULT"."SERV_FAULT_CODE" AND "SERV_CALL_AUDIT"."SERV_SITE"="SERV_CALL_1"."SERV_SITE")
   AND 
      ("SERV_CALL_1"."CALL_LOG_DATE" =<|Last week|>)
   GROUP BY 
      "SERV_CALL_1"."SERVICE_JOB_NUMBER", "SALES_ACC_DETAIL_1"."CUST_NAME", "SERV_CONTRACT_1"."CUSTOMER_REF", "SERV_FAULT"."SERV_FAULT_DESC"
   HAVING 
      (Min("SERV_CALL_AUDIT"."DETAILS") LIKE '04%')

Reply With Quote
  #2  
Old March 16th, 2007, 11:54 AM
o0MattE0o's Avatar
o0MattE0o o0MattE0o is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2005
Location: West London
Posts: 257 o0MattE0o User rank is Corporal (100 - 500 Reputation Level)o0MattE0o User rank is Corporal (100 - 500 Reputation Level)o0MattE0o User rank is Corporal (100 - 500 Reputation Level)o0MattE0o User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 23 h 58 m 55 sec
Reputation Power: 4
Send a message via MSN to o0MattE0o
ignor this I have managed to do a dirty work around by exporting the output with out a count to a text file then importing it into a new table :P

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDB2 Development > DBxtra (Urgent Help)


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway