How to Select Every Row Where Column Value is NOT Distinct

I need to run a select statement that returns all rows where the value of a column is not distinct (e.g. EmailAddress). For example, if the table looks like below: CustomerName EmailAddress Aaron [email protected] Christy [email protected] Jason [email protected] Eric [email protected] John [email protected] I need the query to return: Aaron [email protected] Christy [email protected] John [email protected] I … Read more

selecting unique values from a column

I have a MySQL table which contains the following type of information: Date product 2011-12-12 azd 2011-12-12 yxm 2011-12-10 sdx 2011-12-10 ssdd Here is an example of a script I use to get data from this table: <?php $con = mysql_connect(“localhost”,”username”,”password”); if (!$con) { die(‘Could not connect: ‘ . mysql_error()); } mysql_select_db(“db”, $con); $sql=mysql_query(“SELECT * … Read more

UPDATE multiple rows with different values in one query in MySQL

I am trying to understand how to UPDATE multiple rows with different values and I just don’t get it. The solution is everywhere but to me it looks difficult to understand. For instance, three updates into 1 query: UPDATE table_users SET cod_user=”622057″ , date=”12082014″ WHERE user_rol=”student” AND cod_office=”17389551″; UPDATE table_users SET cod_user=”2913659″ , date=”12082014″ WHERE … Read more

Cron While Editing Post

I have a multi-author blog, on which there are two schedule cron functions. The first function moves all public posts in the pending status after 365 days: if( ! wp_next_scheduled( ‘expire_posts_hook_publish’ ) ) { wp_schedule_event( time(), ‘hourly’, ‘expire_posts_hook_publish’ ); } add_action( ‘expire_posts_hook_publish’, ‘expire_posts_publish’ ); function expire_posts_publish() { global $wpdb; $daystogo = “365”; $sql = “UPDATE … Read more