Jump to content



Welcome to AstaHost - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!

Toggle shoutbox Shoutbox Open the Shoutbox in a popup

@  yordan : (19 June 2013 - 02:28 PM) Long Life To Asta New Era
@  agyat : (19 June 2013 - 01:58 PM) New Era Start At Asta Or Asta Start In New Era. :unsure:
@  yordan : (16 June 2013 - 05:41 PM) You're Welcome, Agyat!
@  agyat : (16 June 2013 - 07:38 AM) Thanks Yordan...
@  velma : (16 June 2013 - 12:06 AM) I Have Asked Opa To Check For A Backup.. He'll Let Me Know Soon :)
@  velma : (16 June 2013 - 12:05 AM) T_T It Seems That Someone Has Deleted That Topic Since I Found The Url Of The Topic But It Gives Me An Error
@  yordan : (15 June 2013 - 10:31 PM) @velma : It's A Tuto On How To Create A Login Program.
@  yordan : (15 June 2013 - 10:31 PM) Happy Birthday To Youuuuuu Agyat!
@  yordan : (15 June 2013 - 10:31 PM) Ba$
@  agyat : (15 June 2013 - 04:41 PM) :(
@  agyat : (15 June 2013 - 04:41 PM) Where The Hall I Were? 15Th Is Almost At End And No-One Wished Me "happy Birthday"!!!
@  velma : (14 June 2013 - 10:39 AM) Which Tutorial Is He Searching For?
@  velma : (14 June 2013 - 10:38 AM) Which Tutorial Is He Searching For?
@  yordan : (14 June 2013 - 07:47 AM) Ok, Have A Look Tomorrow.
@  yordan : (13 June 2013 - 03:19 PM) @velma, Can You Have A Look At Feelay's Problem? Seems That His Tutorial Is Not Searchable Today.
@  Feelay : (13 June 2013 - 08:11 AM) Oh, Haha
@  velma : (12 June 2013 - 05:39 PM) T_T Lately My Levels Of Procrastination..... **sigh**
@  velma : (12 June 2013 - 05:38 PM) I'll Do It Later
@  velma : (12 June 2013 - 05:38 PM) Procrastinators.. People Who Keep Saying "i'll Do This In A Bit"
@  Feelay : (12 June 2013 - 02:05 PM) Deal Punishments To What?

Photo
- - - - -

What Does Pd Pa Mean In Sql Query?


2 replies to this topic

#1 imjjss

imjjss

    Advanced Member

  • Members
  • 162 posts

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?
$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;


#2 yordan

yordan

    Way Out Of Control - You need a life :)

  • [MODERATOR]
  • 4,681 posts

Posted 04 June 2011 - 05:40 PM

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_id
pd.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 sql

From 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;"

#3 manuleka

manuleka

    Way Out Of Control - You need a life :)

  • Members
  • 1,603 posts
  • Gender:Male
  • Location:myComputer
  • myCENTs:41.72

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



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users