$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 ASC
QUERY;
| |
|
Welcome to AstaHost - Dear Guest | |
Toggle shoutbox
Shoutbox
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
What Does Pd Pa Mean In Sql Query?
Started by imjjss, Jun 04 2011 12:29 AM
2 replies to this topic
#1
Posted 04 June 2011 - 12:29 AM
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?
#2
Posted 04 June 2011 - 05:40 PM
pa and pd are short names for tables, for that nice query.What does pd, pa mean in this code?
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".
From a history point of view, "SQL" means "Simple Query Language".I have no knowledge about sql
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;"
#3
Posted 04 June 2011 - 10:24 PM
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
www.w3schools.com/sql/default.asp
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
www.w3schools.com/sql/default.asp
Reply to this topic
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











