简体   繁体   中英

Is this an SQL alias or something else?

In the following code excerpt, I'm wondering what the "p" and "p1" are. My best guess is that they are aliases, but I can find no alias syntax (ex: people AS p) used in the rest of the code.

$query ="SELECT p.* FROM $wpdb->posts p, $wpdb->postmeta p1

Thank you for your help.

They are indeed aliases, this is where they're defined. That's valid SQL syntax, at least in oracle.

The "posts" table is referenced afterwards as "p", and you can see that in the "p.*" part.

Take a look at this question .

Correct, you do not have to use the syntax as to define an alias. Here is a good StackOverflow link that has been answered : Alias

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM