#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    2
    Rep Power
    0

    How to compare same value different days


    Im using mysql workbench, i have created the following table

    Code:
    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 )
    Each day we are provided with a file that has about 8000 of the following querys

    Code:
    INSERT INTO `x_world` VALUES (3207,-398,396,3,94527,'09 Yorgvizzle',26954,'JoeForeshizzle',78,'JUERVA',209);
    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
  2. #2
  3. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,317
    Rep Power
    7170
    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.

    I was curious how I could go about adding in these querys on a daily basis
    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).

    compare the last value (population) looking for decrease or staying the same
    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.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    2
    Rep Power
    0
    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.

IMN logo majestic logo threadwatch logo seochat tools logo