imjjss 0 Report post Posted June 4, 2011 I have no knowledge about sql but I need to run a query. I found an example which get exactly output formate that I want. I plan to borrow this query script but it's very difficult to understand the code, especially, the pd, pa part, What does pd, pa mean in this code? $query = <<<QUERY SELECT DISTINCT(u.ID), u.user_email, u.user_nicename, u.display_name, pd.value FROM $wpdb->users u LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id LEFT JOIN ( SELECT DISTINCT( p.post_author ) ID FROM $wpdb->posts p WHERE p.post_type = 'ep_reg' AND p.post_parent = $postid $for_admin ) pa ON u.ID = pa.ID WHERE u.user_status = 0 AND pa.ID IS NULL AND pd.field_id = 1 ORDER BY pd.value ASCQUERY; Share this post Link to post Share on other sites
yordan 10 Report post Posted June 4, 2011 What does pd, pa mean in this code?pa and pd are short names for tables, for that nice query.ON u.ID = pd.user_idpd.user means the colum "user" of the "pd" table.AND pa.ID IS NULL"pa.id IS NULL" means there is no value in the field "ID" for this row of the table "pa".I have no knowledge about sqlFrom a history point of view, "SQL" means "Simple Query Language".This was supposed to be a very simple language for querying data, a language supposed to be simple because it's near the natural (English) language.For instance, selecting the names of the employees being overpaid should sound like "select * from employees where salary greater than 2000;" Share this post Link to post Share on other sites
manuleka 0 Report post Posted June 4, 2011 yes tables... and @ yordan, yes it isn't simple from a newbies perspective! although when i started learning SQL it seem quite simple (the basics) at first which can be quite straight forward until you get to do more complex queries... i suggest googling for some free introductory e-books on SQL or even online Tutorials... should give you some brief idea about SQL... good place to start is w3schools http://www.w3schools.com/sql/default.asp Share this post Link to post Share on other sites