February 23rd, 2013, 10:10 PM
How to compare same value different days
Im using mysql workbench, i have created the following table
Each day we are provided with a file that has about 8000 of the following querys
CREATE TABLE [x_world](
[worldid] [tinyint] NULL,
[id] [int] NULL,
[x] [smallint] NULL,
[y] [smallint] NULL,
[tid] [tinyint] NULL,
[vid] [int] NULL,
[village] [nvarchar](50) NULL,
[uid] [int] NULL,
[player] [nvarchar](50) NULL,
[aid] [int] NULL,
[alliance] [nvarchar](20) NULL,
[population] [smallint] NULL )
I was curious how I could go about adding in these querys on a daily basis and compare the last value (population) looking for decrease or staying the same
INSERT INTO `x_world` VALUES (3207,-398,396,3,94527,'09 Yorgvizzle',26954,'JoeForeshizzle',78,'JUERVA',209);
February 24th, 2013, 01:27 AM
Are you sure this is MySQL? Because the CREATE TABLE query you posted looks a lot like MSSQL and wouldn't actually execute at all under MySQL.
This process would be done outside of MySQL. You could create a scheduled task or CRON job to automatically invoke the MySQL command line program to execute a file containing SQL statements (the file you receive).
This would not be possible unless I'm missing something, because your table does not contain any column to store the date. If you add a column to store the date, then you can run a query to retrieve this information.
February 27th, 2013, 04:59 PM
thank you for your quick response, what would you suggest making a tool in then? The query i posted cant be changed the sql file they provide us has 8k of those daily. I could look into learning a new language to make a tool to compare populations for me.