简体   繁体   English

这是SQL别名还是其他?

[英]Is this an SQL alias or something else?

In the following code excerpt, I'm wondering what the "p" and "p1" are. 在下面的代码摘录中,我想知道“ p”和“ p1”是什么。 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. 我最好的猜测是它们是别名,但是在其余的代码中我找不到别名语法(例如:people AS p)。

$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. 那是有效的SQL语法,至少在oracle中是如此。

The "posts" table is referenced afterwards as "p", and you can see that in the "p.*" part. 之后,“职位”表被称为“ p”,您可以在“ p。*”部分中看到它。

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 这是一个很好的StackOverflow链接,已经得到了解答: 别名

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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