Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2

Thread: mySQL query

  1. #1
    Junior Member
    Join Date
    May 2004
    Posts
    1
    Member #
    6099
    I have this problem - have mySQL database with table that collects information for users. This table should consist one record for every month in the year for every user. The problem is that some months are missing and I would like to know them.
    The users are too much - over 2500 and the time period is around 6 years - and my algorhytm seems to work too slow...
    The database is something like that

    | user_id | year | month | some other info |

    My aproach is folowing - for every user select all the records in this period and start looping the query result for every year 12 months - this is nested loop - it's too slow. And takes unbelivable long time to get the list of all missing months for all the users - ... think it's the database desig problem but unforutunately I can't change the design

    Do you have any idea how to resolve the problem?

  2.  

  3. #2
    Senior Member jlgosse's Avatar
    Join Date
    Jan 2004
    Location
    Newfoundland, Canada
    Posts
    1,037
    Member #
    4570
    Liked
    7 times
    Make an array of years and months probably, or two seperate arrays, and cycle through them in the loop. An array oof months and an auto-incrementing year value would work, I think.



Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 12:14 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com