Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.
View this topic in a long page with up to 500 replies per page Create new topic
1 | 2 | 3 
435 posts

Ultimate Geek
+1 received by user: 68


  Reply # 481867 16-Jun-2011 14:22
Send private message

Your export query has a backslash after the AND - is that the problem?

435 posts

Ultimate Geek
+1 received by user: 68


  Reply # 481872 16-Jun-2011 14:24
Send private message

If it is an issue (and I doubt it is, I suspect its something else) you could create a view with all of the SELECT statement you've come up with without the AND bit.

Then just export from the view using a query that is:

SELECT * FROM MyView WHERE RemotelocationID = 11



58 posts

Master Geek


  Reply # 481893 16-Jun-2011 14:54
Send private message

Ah yes, that slash after the AND doesn't actually exist, I somehow added that after my copy & paste.

FlameRobin exports a Grid to CSV natively, even though it's tab delmited, but unfortunately there's no way to schedule it to reoccur, hence why I'm using FBExport.exe, because I can't find another command line tool which I can set up in windows task scheduler to generate a comma delimited csv on a specified interval.

Effectively I'll take 15 copies of the batch file, changing the remotelocationID for each, schedule the batches to run every 15 minutes and upload to a webserver which will then provide the data to a flash chart, which will in effect update every 15 minutes.

Would you believe I don't even know what a VIEW is?  Total database novice Tongue out

Edit:  Oh I see, right beneath triggers.  I'll have a play.  Does the view automatically update according to the data its referencing?



58 posts

Master Geek


  Reply # 481925 16-Jun-2011 16:00
Send private message

I think this might just work, but I'm stuck on something extremely simple.
In the select query, after removing the "where remotelocationid = 12", where do I add the "remotelocationid" to atleast call the column so it's shown in the view?

SELECT extract(hour from hourlist.HOURVALUES) HR,
COALESCE(sum(salestax * 7.66666666), 0) SALES
FROM HOURLIST, (SELECT remotelocationid FROM invoice)
LEFT OUTER JOIN INVOICE ON extract(HOUR from hourvalues) = EXTRACT(HOUR FROM wheninvoiced)
and wheninvoiced >= 'today'  
group by HOURLIST.HOURVALUES order by hourlist.HOURVALUES

The above freezes/taking a very long time to execute.  oops.

Edit:  Come to think of it, this is going to be impossible, because the select statement is collating all the data from EVERY remotelocation, so it's not going to be able to report what data belongs to what location because it's hourly collation of all sales data?

Edit2:  So perhaps the best plan of attack is to create a view for each remotelocation, remove the "and wheninvoiced >= 'today", then all I need FBexport to do is SELECT * FROM CHARTVIEW1 WHERE wheninvoiced >= 'today'.  I'll try that.



58 posts

Master Geek


  Reply # 481940 16-Jun-2011 16:36
Send private message

I can't explain it, but this works without a view in FBExport:

"SELECT extract(hour from hourlist.HOURVALUES) HR, COALESCE(sum(salestax * 7.66666666), 0) SALES FROM HOURLIST LEFT OUTER JOIN INVOICE ON extract(HOUR from hourvalues) = EXTRACT(HOUR FROM wheninvoiced) where wheninvoiced >= 'today' and remotelocationid = 11 group by HOURLIST.HOURVALUES order by hourlist.HOURVALUES"

It only returns hours for which data exists, but after 3 days, I'll happily live with that.

435 posts

Ultimate Geek
+1 received by user: 68


  Reply # 481985 16-Jun-2011 19:52
Send private message

This relates to my comment about where you put particular restrictions with a LEFT OUTER JOIN.

If you changed your query to this:
SELECT extract(hour from hourlist.HOURVALUES) HR, COALESCE(sum(salestax * 7.66666666), 0) SALES FROM HOURLIST LEFT OUTER JOIN INVOICE ON extract(HOUR from hourvalues) = EXTRACT(HOUR FROM wheninvoiced) and wheninvoiced >= 'today' and remotelocationid = 11 group by HOURLIST.HOURVALUES order by hourlist.HOURVALUES

It'll probably give you what you want.  I've moved the wheninvoiced and remotelocationid into the join.  The effect is to work out the restricted set of data we're interested in then join to the list of hours we want to match against.

1 | 2 | 3 
View this topic in a long page with up to 500 replies per page Create new topic

Twitter »

Follow us to receive Twitter updates when new discussions are posted in our forums:



Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:



Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:





News »

Hawaiki Transpacific cable ready-for-service
Posted 20-Jul-2018 11:29


Microsoft Dynamics 365 Business Central launches
Posted 10-Jul-2018 10:40


Spark completes first milestone in voice platform upgrade
Posted 10-Jul-2018 09:36


Microsoft ices heated developers
Posted 6-Jul-2018 20:16


PB Technologies charged for its extended warranties and warned for bait advertising
Posted 3-Jul-2018 15:45


Almost 20,000 people claim credits from Spark
Posted 29-Jun-2018 10:40


Cove sells NZ's first insurance policy via chatbot
Posted 25-Jun-2018 10:04


N4L helping TAKA Trust bridge the digital divide for Lower Hutt students
Posted 18-Jun-2018 13:08


Winners Announced for 2018 CIO Awards
Posted 18-Jun-2018 13:03


Logitech Rally sets new standard for USB-connected video conference cameras
Posted 18-Jun-2018 09:27


Russell Stanners steps down as Vodafone NZ CEO
Posted 12-Jun-2018 09:13


Intergen recognised as 2018 Microsoft Country Partner of the Year for New Zealand
Posted 12-Jun-2018 08:00


Finalists Announced For Microsoft NZ Partner Awards
Posted 6-Jun-2018 15:12


Vocus Group and Vodafone announce joint venture to accelerate fibre innovation
Posted 5-Jun-2018 10:52


Kogan.com to launch Kogan Mobile in New Zealand
Posted 4-Jun-2018 14:34



Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.