RE: Request for help on (My)SQL Statement

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm running a notification script that does an action if the date of the last post is greater than the last time the script ran, which is the value stored in the other table. The action is to notify the members if there has been a new post in the past 24 hours. 

The client is trying to generate traffic - the members aren't using the site. She figures if they are reminded when there's activity on the site (without just forwarding all posts to the members - she doesn't want to turn it into a mailing list per se) they'll start using it.

The design may be flawed but I don't know any other way to do it. As long as it serves the purpose and isn't a total abomination... :)

Thanks,

John

-----Original Message-----
From: Micah Stevens [mailto:micah@xxxxxxxxxxxxxxxxxx]
Sent: Tuesday, April 27, 2004 5:30 PM
To: Bedard, John
Cc: php-db@xxxxxxxxxxxxx
Subject: Re:  Request for help on (My)SQL Statement


Not with MySQL that I know of, some local guru might have an idea.. 

Why are you storing the data in another table? Usually duplicating data in a 
database is a big signal of flawed design. If you're using it somewhere else, 
just select it from the originating table each time. Unless you're trying to 
do something else that I'm not taking into account.

-Micah


On Tuesday 27 April 2004 04:14 pm, John.Bedard@xxxxxxx wrote:
> So you're saying there's no way to do it in this version with a single
> statement?
>
> Thanks,
>
> John
>
> -----Original Message-----
> From: Micah Stevens [mailto:micah@xxxxxxxxxxxxxxxxxx]
> Sent: Tuesday, April 27, 2004 5:00 PM
> To: php-db@xxxxxxxxxxxxx
> Subject: Re:  Request for help on (My)SQL Statement
>
>
>
> That would be the way to do it except that MySQL doesn't support
> sub-selects until version 4.1, which is in alpha still.
>
> -Micah
>
> On Tuesday 27 April 2004 04:05 pm, Swan, Nicole wrote:
> > Have you tried a nested query?  I think your problem is that you're
> > really using information from two different tables.
> >
> > Maybe:
> >
> > UPDATE ngc_polling SET lastrundate = (SELECT max(post_time) FROM
> > nuke_phpbb_posts);
> >
> >
> > --Nicole
> > ---------------------------
> > Nicole Swan
> > Web Programming Specialist
> > Carroll College CCIT
> > Helena, Montana
> > (406)447-4310
> >
> >
> > -----Original Message-----
> > From: John.Bedard@xxxxxxx [mailto:John.Bedard@xxxxxxx]
> > Sent: Tuesday, April 27, 2004 4:52 PM
> > To: php-db@xxxxxxxxxxxxx
> > Subject:  Request for help on (My)SQL Statement
> >
> > :::Novice Alert:::
> >
> > I've done simple select and insert statements, so I suppose this is the
> > most complicated thing I've tried to do. but seems to me it should be
> > pretty easy. But I'm a designer by background, not a developer or
> > programmer. I've got everything else I'm trying to do working.
> >
> > I'm trying to take the largest value out of one table and update another
> > table. The former is a PHPBB table and the latter is a table I created
> > just to store the value of the date of the most recent post for use in
> > something else.
> >
> > UPDATE ngc_polling SET lastrundate = max(nuke_phpbb_posts.post_time)
> >
> > It returns "Invalid use of group function."
> >
> > I've been looking at the documentation on MySQL.com to no avail. I'm
> > testing my query in phpMyAdmin before I try to implement it elsewhere.
> > This is what I'm trying to do, any help besides "RTFM" (been doing that)
> > would be greatly appreciated.
> >
> > Thanks!
> >
> > John
> >
> > John Bedard | Interaction Designer (SWEIII) | Northrop Grumman Mission
> > Systems | Helena, Montana, U.S.A. | john.bedard@xxxxxxx | 406.443.8630 |
> > Fax 406.443.8601 |

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux