For php database operations, see og. id, og. orderid =: orderid, gong. id.

Source: Internet
Author: User
Tags php database
The og. id, og. orderid: orderid, gong. id, what does pdo_fetchall ("select og. id, og. realprice, og. total, g. hascommission, g. nocommission, g. commissionraterate, g. commission1_pay, g. commission2_rate, g. commission2_pay, g. commission3_rate, g. commission3_pay from ". tablename (shop_order_goods '). 'og '. 'Left join '. tablename ('shop _ goods '). 'G on g. id = og. goodsid '. 'Where og. orderid =: orderid and og. uniacid =: uniacid ', array (
': Orderid' => $ orderid,

Og. such as og. id and og. realprice are added before each field. what does this mean?

The database has the id and goodsid fields, but what does the form g on g. id mean.

And og. uniacid =: og such as uniacid. what does the colon mean after the equal sign?


Reply to discussion (solution)

XXX. xxx XXX is an alias

: Uniacid is the parameter name for parameter passing.

XXX. xxx XXX is an alias

: Uniacid is the parameter name for parameter passing.


Is the alias casually named? What is the alias used for? what is the difference between this alias and the field used directly?

G on g. id. There are also letters, spaces, and letters in front of the dot.

Og may be an alias or a database name.
For example
Select * from member as a where a. uid = 1; here a is the alias of member

Select * from abc. member; here abc is the database name.

For your
... From ". tablename (shop_order_goods '). 'og'. 'left join'. tablename ('shop _ goods '). 'G...
Tablename (shop_order_goods ') and tablename ('shop _ goods') return the table name, which is not a definite value.
In the association expression on g. id = og. goodsid, if g and og do not use aliases, they have to call those two functions, which is very bloated.

Og may be an alias or a database name.
For example
Select * from member as a where a. uid = 1; here a is the alias of member

Select * from abc. member; here abc is the database name.


What is the meaning of an alias?


Og may be an alias or a database name.
For example
Select * from member as a where a. uid = 1; here a is the alias of member

Select * from abc. member; here abc is the database name.


What is the meaning of an alias?



It can be written shorter.

For example, if your table name is information_schema_member and information_abc, you need to join

Do not use aliases
Select information_schema_member.name, information_abc.addtime from information_schema_member join information_abc on information_schema_member.id = information_abc.uid;

Use alias
Select a. name, B. addtime from information_schema_member as a join information_abc as B on a. id = B. uid;



Og may be an alias or a database name.
For example
Select * from member as a where a. uid = 1; here a is the alias of member

Select * from abc. member; here abc is the database name.


What is the meaning of an alias?



It can be written shorter.

For example, if your table name is information_schema_member and information_abc, you need to join

Do not use aliases
Select information_schema_member.name, information_abc.addtime from information_schema_member join information_abc on information_schema_member.id = information_abc.uid;

Use alias
Select a. name, B. addtime from information_schema_member as a join information_abc as B on a. id = B. uid;


After the join operation is completed, the alias can be used for other database calls?



Og may be an alias or a database name.
For example
Select * from member as a where a. uid = 1; here a is the alias of member

Select * from abc. member; here abc is the database name.


What is the meaning of an alias?



It can be written shorter.

For example, if your table name is information_schema_member and information_abc, you need to join

Do not use aliases
Select information_schema_member.name, information_abc.addtime from information_schema_member join information_abc on information_schema_member.id = information_abc.uid;

Use alias
Select a. name, B. addtime from information_schema_member as a join information_abc as B on a. id = B. uid;


It seems so. thank you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.