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 
nzkc
1571 posts

Uber Geek


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

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



nzkc
1571 posts

Uber Geek


  #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

Acropoli

58 posts

Master Geek


  #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?



Acropoli

58 posts

Master Geek


  #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.

Acropoli

58 posts

Master Geek


  #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.

nzkc
1571 posts

Uber Geek


  #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





News and reviews »

Air New Zealand Starts AI adoption with OpenAI
Posted 24-Jul-2025 16:00


eero Pro 7 Review
Posted 23-Jul-2025 12:07


BeeStation Plus Review
Posted 21-Jul-2025 14:21


eero Unveils New Wi-Fi 7 Products in New Zealand
Posted 21-Jul-2025 00:01


WiZ Introduces HDMI Sync Box and other Light Devices
Posted 20-Jul-2025 17:32


RedShield Enhances DDoS and Bot Attack Protection
Posted 20-Jul-2025 17:26


Seagate Ships 30TB Drives
Posted 17-Jul-2025 11:24


Oclean AirPump A10 Water Flosser Review
Posted 13-Jul-2025 11:05


Samsung Galaxy Z Fold7: Raising the Bar for Smartphones
Posted 10-Jul-2025 02:01


Samsung Galaxy Z Flip7 Brings New Edge-To-Edge FlexWindow
Posted 10-Jul-2025 02:01


Epson Launches New AM-C550Z WorkForce Enterprise printer
Posted 9-Jul-2025 18:22


Samsung Releases Smart Monitor M9
Posted 9-Jul-2025 17:46


Nearly Half of Older Kiwis Still Write their Passwords on Paper
Posted 9-Jul-2025 08:42


D-Link 4G+ Cat6 Wi-Fi 6 DWR-933M Mobile Hotspot Review
Posted 1-Jul-2025 11:34


Oppo A5 Series Launches With New Levels of Durability
Posted 30-Jun-2025 10:15









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.