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 
380 posts

Ultimate Geek
+1 received by user: 38


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

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

380 posts

Ultimate Geek
+1 received by user: 38


  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.

380 posts

Ultimate Geek
+1 received by user: 38


  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 »

Mobile market competition issues ComCom should watch
Posted 18-Dec-2017 10:52


New Zealand government to create digital advisory group
Posted 16-Dec-2017 08:47


Australia datum changes means whole country moving 1.8 metres north-east
Posted 16-Dec-2017 08:39


UAV Traffic Management Trial launching today in New Zealand
Posted 12-Dec-2017 16:06


UFB connections pass 460,000
Posted 11-Dec-2017 11:26


The Warehouse Group to adopt IBM Cloud to support digital transformation
Posted 11-Dec-2017 11:22


Dimension Data peeks into digital business 2018
Posted 11-Dec-2017 10:55


2018 Cyber Security Predictions
Posted 7-Dec-2017 14:55


Global Govtech Accelerator to drive public sector innovation in Wellington
Posted 7-Dec-2017 11:21


Stuff Pix media strategy a new direction
Posted 7-Dec-2017 09:37


Digital transformation is dead
Posted 7-Dec-2017 09:31


Fake news and cyber security
Posted 7-Dec-2017 09:27


Dimension Data New Zealand strengthens cybersecurity practice
Posted 5-Dec-2017 20:27


Epson NZ launches new Expression Premium Photo range
Posted 5-Dec-2017 20:26


Eventbrite and Twickets launch integration partnership in Australia and New Zealand
Posted 5-Dec-2017 20:23



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.