Jump to content

mrmitch

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Posts posted by mrmitch

  1.  

     

    I suppose that's one way of describing it. IMHO, here's a few more

     

    bizarre, burlesque, comical, crazy, farcical, foolish, grotesque, laughable, ludicrous, nonsensical, outlandish, preposterous, risible, silly, zany

     

    HAHA - You have a knack for explaining things. :)

     

     

    As for greenie's problem - I still see no reason you'd want to do all that work when you can just have each record linked to the user responsible by their id or whatever you use to recognize them. This is a relational DB for a reason - to build relationships.

    You're going to have to make update scripts that run whenever these people log in, which takes more of their time, whenever you need to perform maintenance, or have a script that logs in as each user to update their db, taking time and resources. How many db's are we talking about anyway? Maintenance alone would be a bear.

     

     

     

  2. Adding the carat before the group will search at the beginning of the movie name only, so the movie has to start with a number.

     

     

    REGEXP '^[0-9]%'

  3. So, rather than have one database and keying/linking all the rows with the unique user id, he creates and destroys similar databases for each user every time they log in/out.

     

    Interesting idea, but I'm with fenway - why??

    You would have to be seriously cramped for database space in order to think this was a good idea. Query wise, MySQL is fast enough to work on extremely large databases, so there's no reason to worry about table size, in most cases.

     

    Security? There are better ways.

     

  4. What does the other query return?

     

    Try it with a MAX on timestamp and grouping by the user id.

     

    $GetAllSites = @mysql_query("SELECT userID, sitePref, MAX(timeStamp), valid FROM dental_emerg WHERE valid = 0 GROUP BY userID");
             while ($GetAllSites2 = @mysql_fetch_array($GetAllSites))
             {
                echo $GetAllSites2['timeStamp'] . "<br>";
             }
    [\code]

  5.  

    The lower date needs to go first to produce a positive result. I put > on both - sorry.

     

    begin date, beginning before '2008-12-31' is correct with the event_begn first, because it will be the earlier date.

     

    End date needs reversed, or the sign changed. Ending after '2008-12-01', so Dec 1st is always the earlier date.

     

    DATEDIFF('2008-12-01',event_date_end)>=0

     

    Hope this helps!

     

    Mitch

     

     

     

     

  6. I think the first statement was close, but the second left join needed clarifying (if this will run in MySQL)

     

    SELECT players.playerID, players.playerFirstName, players.playerLastName, 
    COUNT(games.playerID) as gamesplayed, COUNT(tries.playerID) as triesscored FROM 
    players LEFT JOIN games ON players.playerID = games.playerID, 
    players LEFT JOIN tries ON players.playerID = tries.playerID GROUP BY players.playerID

  7. Scratch that - Use DATEDIFF on Jan 1 2009 and Jan 31 2009 checking for >=0 and <=0 instead of the 2 betweens.

     

    DATEDIFF( event_date_end, '01-01-2008')>=0 (ends after jan 1) and DATEDIFF(event_date_begin,'01-31-2008')<=0 (begins before jan 31)

     

    This will find any date that begins before the end of the month AND ends after the beginning of the month. So beginning in November 2008 and ending in Jan 28 2009 (or Feb) matches because it begins before the end of January and ends after the beginning of January. Jan 2 - Jan5 begins before the end of the month and ends after the beginning of the month. This removes the need for the OR in your select too.

     

    Hope this helps!

     

    Mitch

    3CG Developing (ask.3cgdeveloping.com)

     

     

    The between on your year is filtering everything out. It's looking for events that will start in 2008 and end in 2010 to find 2009 between.

     

     

     

  8. What happens when you run the query directly against the db?

     

    Switching to a left join will only pull out the left table, orders. It's not finding a match, so it's not displaying anything. If there is supposed to be a match, then you have a bigger problem.

     

    I'd also suggest using id's and not names on matching. Databases match integers much faster than strings.

     

  9. It may just be a simple syntax problem. Try parenthesizing (if that's a word) your and's from the or.

     

    SELECT event_id, event_date_begin, event_date_end FROM events WHERE ( (1 BETWEEN MONTH(k.event_date_begin) AND MONTH(event_date_end) ) AND ( 2009 BETWEEN YEAR(event_date_begin) AND YEAR(event_date_end) ) ) OR MONTH(event_date_begin) = 1 ORDER BY event_id ASC

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.