*和。的含义。在MySql中

时间:2017-09-09 09:36:40

标签: mysql sql

我不明白在此查询中使用e.*at_firstname.value

SELECT e.*
     , at_firstname.value AS firstname 
  FROM customer_entity AS e 
 INNER 
  JOIN customer_entity_varchar AS at_firstname 
    ON (at_firstname.entity_id = e.entity_id) 
   AND (at_firstname.attribute_id = '5') 
 WHERE (e.entity_type_id = '1') 
   AND (at_firstname.value = 'sander') 
 ORDER 
    BY e.email ASC 

2 个答案:

答案 0 :(得分:1)

可能是你的意思

 SELECT e.*, at_firstname.value AS firstname 
  FROM  `customer_entity` AS `e`
  INNER JOIN at_firstname   ON
    at_firstname.entity_id = e.entity_id AND at_firstname.attribute_id = '5'
  WHERE e.entity_type_id = '1' AND at_firstname.value = 'sander' ORDER BY e.email ASC 

e是表customer_entity(customer_entity AS e)的别名,因此e。*表示表customer_entity的所有列。

at_firstname.value似乎是一个错误,因为连接条件只需要表名而不是table.column

无论如何,sintax at_firstname.value AS firstname表示使用列的别名firtsname显示tablename.columnname

否则,如果原始查询是正确的at_firstname.value AS名字 是数据库at_firstname的表别名at_firstname(列名值)的别名和表值

当不需要时,PS不会使用unuseful()条件

答案 1 :(得分:0)

使用 <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:textColorHint="#565d66"> <EditText android:id="@+id/userEditText" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/registration.hint.user" android:textColor="#565d66" android:theme="@style/Custom.EditText" /> </android.support.design.widget.TextInputLayout> // this is the theme i'm using in editText: <style name="Custom.EditText" parent="Base.Widget.AppCompat.EditText"> <item name="colorControlNormal">#565d66</item> <item name="colorControlHighlight">@color/colorPrimary</item> <item name="colorControlActivated">@color/colorPrimary</item> </style> ,您可以选择表格e.*中的所有列 e仅使用表at_firstname.value中的value列。