XMB Forum Software
Not logged in [Login - Register]
Go To Bottom

Printable Version  
Author:

Anyone with a good SQL knowledge ?

Mouser
XMB Contributor
********


Avatar


Posts: 198
Registered: 4-14-2008
Member Is Offline

Mood: Christmasy. Yes, in September.

[*] posted on 10-17-2012 at 09:36 PM
Anyone with a good SQL knowledge ?


Hi all,

Don't know if this is the right spot for this, but I thought I'd try.

I'm facing an issue, that someone with some SQL knowledge can figure out just by looking at it.
I managed to receive some daily logging, and would like some statistics generated out of them.
What I managed to do... Write a VB script to;
a) Copy the logs , and extract the content (it's a compressed GZ file).
b) Create an SQL file that;
b 1) creates a seperate database-table for each (csv) log file,
b 2) import the extracted CSV file into the database-table.
c) Execute the SQL file on the MySQL-commandline.


Here is a simple representation of layout of such table (1 table per day, being called something like AB_20121010, AB_20121011, AB_20121012 <-- See how these numbers are the date YYYY MM DD)

2wobtbs.png - 7kB



Now I've been trying to figure out;

1) How to populate a table called "statistics_a" with the following information

dlqqz7.png - 3kB

2) How to populate a table called "statistics_b" with the following information

4hsg88.png - 6kB



Would be great, if this could be done in said SQL file, and not some PHP queries or something.

But I can't seem to figure it out :S


Any tips, highly appreciated.
View user's profile View All Posts By User
lottos
Administrator
********




Posts: 357
Registered: 6-3-2002
Location: Competitions Australia: https://www.lottos.com.au/
Member Is Offline

Mood: pass me a TimTam

[*] posted on 10-18-2012 at 08:36 AM


It would be better if you also said exactly what you are populating the two stats tables with (ie, how is the data determined), then you can look at how to do it with sql


SELECT (
SELECT COUNT(*)
FROM source_table WHERE...
) AS tot_one,
(
SELECT COUNT(*)
FROM source_table WHERE...
) AS tot_two,
(
SELECT COUNT(*)
FROM source_table WHERE...
) AS tot_three


INSERT INTO target_table(tot_one, tot_two, tot_three)




Largest list of competitions online!
View user's profile Visit user's homepage View All Posts By User
Mouser
XMB Contributor
********


Avatar


Posts: 198
Registered: 4-14-2008
Member Is Offline

Mood: Christmasy. Yes, in September.

[*] posted on 10-21-2012 at 09:16 PM


Thank you lottos! That gave me the right idea on how to accomplish my goal :D
View user's profile View All Posts By User
lottos
Administrator
********




Posts: 357
Registered: 6-3-2002
Location: Competitions Australia: https://www.lottos.com.au/
Member Is Offline

Mood: pass me a TimTam

[*] posted on 10-22-2012 at 04:48 AM


Quote: Originally posted by Mouser  
Thank you lottos! That gave me the right idea on how to accomplish my goal :D


You're very welcome, glad you obtained the results you wanted!





Largest list of competitions online!
View user's profile Visit user's homepage View All Posts By User

  Go To Top

Powered by XMB 1.9.11 (Debug Mode)
Forum Script Software by XMB © 2001-2019 The XMB Group
[Queries: 16] [PHP: 30.5% - SQL: 69.5%]
Funded with thanks to competitions website.