RE: [firebird-support] QUERY QUESTION

2017-03-06 Thread 'Stef' s...@autotech.co.za [firebird-support]
mNr = TTNot.ItemNr AND TTFirst.DateUsed - 1 = TTNot.DateUsed) AND TTLast.DateUsed <= :MyEarlierDate GROUP BY 1) SELECT ItemNr, LastDate, LastDate - FirstDate + 1 as ConsecutiveDays FROM TMP 2017-03-06 7:44 GMT+01:00 'Stef' s...@autotech.co.za [firebird-s

RE: [firebird-support] QUERY QUESTION

2017-03-05 Thread 'Stef' s...@autotech.co.za [firebird-support]
-support@yahoogroups.com] Sent: 03 March 2017 10:27 PM To: firebird-support@yahoogroups.com Subject: Re: [firebird-support] QUERY QUESTION Den 02.03.2017 17:36, skrev 'Stef' s...@autotech.co.za [firebird-support]: > Good day, > > I have a question for you SQL boffins, how can I query a tab

RE: [firebird-support] QUERY QUESTION

2017-03-02 Thread 'Stef' s...@autotech.co.za [firebird-support]
Edward Thank you very much, it is something like this that I am looking for. The only issue is that I only need to find the count for the latest consecutive days used. i.e. If the itemnr was used for 12 weeks consecutively and then had a day(or two) off and then used again for 5

[firebird-support] QUERY QUESTION

2017-03-02 Thread 'Stef' s...@autotech.co.za [firebird-support]
Good day, I have a question for you SQL boffins, how can I query a table to get the count of consecutive days found ? A Table contains rows with dates where an item(s) has been added for every day this item was used. i.e. itemnr dateused abc

RE: [firebird-support] FIREBIRD PIVOT function or Matrix

2017-02-15 Thread 'Stef' s...@autotech.co.za [firebird-support]
: > 14.02.2017 14:15, 'Stef' s...@autotech.co.za [firebird-support] wrote: >> Any suggestions on my DB design and query to display the values in matrix >> (pivot) format? > > Simple client-side code can show you the matrix in any convenient form. There > is no > point to do that

RE: [firebird-support] FIREBIRD PIVOT function or Matrix

2017-02-15 Thread 'Stef' s...@autotech.co.za [firebird-support]
Thanks all But this still does not answer my question as to db design and query? Regards Stef van der Merwe From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] Sent: 14 February 2017 06:03 PM To: 'Leyne, Sean' s...@broadviewsoftware.com

[firebird-support] FIREBIRD PIVOT function or Matrix

2017-02-14 Thread 'Stef' s...@autotech.co.za [firebird-support]
Hi all, I don't see a PIVOT function available in Firebird 2.5 What would be the best way to design and query a matrix in firebird. I need a distance matrix to indicate the distance between several cities. Cities will be need to be added and distances adjusted as time goes by. Any

RE: [firebird-support] Case sql

2017-01-05 Thread 'Stef' s...@autotech.co.za [firebird-support]
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] Sent: 05 January 2017 04:48 PM To: firebird-support@yahoogroups.com; 'Stef' s...@autotech.co.za [firebird-support] Subject: Re: [firebird-support] Case sql Hi, "case" is function a

[firebird-support] Case sql

2017-01-05 Thread 'Stef' s...@autotech.co.za [firebird-support]
Good day everybody, I have the following query select D.NAME as NAME, (case (extract (Weekday from P.plandate )) when 1 then (P.PLANSTATUS) else '' end) as Monday, (case

[firebird-support] DATA COMPARISON

2015-10-05 Thread 'Stef' s...@autotech.co.za [firebird-support]
Hi All Is there a query structure available I can use to identify where records have been change or are missing between two table with the exact table structure? i.e. I store a backup of financial data annually in separate tables. JOURNAL2013 JOURNAL2015 JOURNAL2015 etc. where

[firebird-support] Slow Query

2015-09-22 Thread 'Stef' s...@autotech.co.za [firebird-support]
Hi All Can somebody please have a look at this query and let me know how I can improve the performance (10 seconds execute time) with DateSource(suppid, ddate, source2) as (select distinct suppid, ddate, source2 from journal

[firebird-support] DeadLock Conflict

2015-08-24 Thread 'Stef' s...@autotech.co.za [firebird-support]
Hi All If possible at all, how can I trace which workstation (Firebird Client) is holding a record hostage and thus causing a deadlock conflict? Regards Stef van der Merwe email s...@autotech.co.za [Non-text portions of this message have been removed]

RE: [firebird-support] Firebird migration to increase perfomances

2015-06-24 Thread 'Stef' s...@autotech.co.za [firebird-support]
Hi Set Yes this is 100% thank you so much. See the query time below mine compared to yours. Note specifically the execute time. My Query Query Time Prepare : 31.00 ms Execute :

RE: [firebird-support] Firebird migration to increase perfomances

2015-06-23 Thread 'Stef' s...@autotech.co.za [firebird-support]
Yes I just checked my original query will return 6 rows without the distinct Stef From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] Sent: 23 June 2015 01:16 PM To: firebird-support@yahoogroups.com Subject: RE: [firebird-support] Firebird migration to

RE: [firebird-support] Firebird migration to increase perfomances

2015-06-23 Thread 'Stef' s...@autotech.co.za [firebird-support]
Hi Set Below is the actual data from the journal table as per the example I mentioned in my previous email Both the customer and cashcustomer tables only have 1 record each JOURID JDATE JTYPE MODULE TRXDATE SOURCEID SOURCE DEBITAMOUNT DESCRIPTION STAFFID STATUS ACCNR

RE: [firebird-support] Firebird migration to increase perfomances

2015-06-23 Thread 'Stef' s...@autotech.co.za [firebird-support]
Hi Set Wow your query runs like a bat out of hell J 0.16 Milliseconds !! and it easier to maintain as you say. The only issue is that it somehow multiplies the totals by 6 on all results as compared mine? i.e. mine will return an invoice total of say 18500.00 and yours will return

RE: [firebird-support] Firebird migration to increase perfomances

2015-06-22 Thread 'Stef' s...@autotech.co.za [firebird-support]
Hi All I am not a SQL master but do know the basics. I am have an issue with sub select queries and setting conditions. Attached is the query I have a problem with, see my comments on the last condition. Please assist me if you can. Stef van der Merwe P.S see below is my

RE: [firebird-support] Firebird migration to increase perfomances

2015-06-22 Thread 'Stef' s...@autotech.co.za [firebird-support]
My apology here is the actual query Select distinct trim(surname)as surname, trim(name)as name, trxdate, source,

[firebird-support] SQL Case query takes 4 minutes 30 seconds to execute !!

2015-04-29 Thread 'Stef' s...@autotech.co.za [firebird-support]
I sincerely hope I am in the right place. We have a query which takes 4 minutes 30 seconds to execute this is simply too long. Please help ! I am going to list as much detail as possible Firebird Version = WI-V2.5.2.26540 Firebird 2.5 Operating system = 32 bit Window 7

RE: [firebird-support] Re: SQL Case query takes 4 minutes 30 seconds to execute !!

2015-04-29 Thread 'Stef' s...@autotech.co.za [firebird-support]
To: firebird-support@yahoogroups.com Subject: [firebird-support] Re: SQL Case query takes 4 minutes 30 seconds to execute !! On Wed, 29 Apr 2015 08:39:02 +0200, 'Stef' s...@autotech.co.za [firebird-support] firebird-support@yahoogroups.com wrote: Is it intended, that internal query would return