如果我查询包含2017(或任何其他年份)的条目的时间戳列,我得到0结果。
w_presse_erscheinung中的数据是“没有时区的时间戳” 并且看起来像这样:2017-06-01 00:00:00
我认为查询的LIKE部分有问题...
我的查询如下:
$result = pg_query("
SELECT
name,
w_presse_link,
w_presse_erscheinung,
w_presse_quelle,
description
FROM adempiere.w_presse
WHERE isactive ='Y'
AND description='PS' AND w_presse_erscheinung LIKE '%2017%'
ORDER BY w_presse_erscheinung
DESC
")
答案 0 :(得分:2)
您可以从时间戳中明确提取年份,而不是依赖字符串转换:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground">
<!-- your custom spinner item view -->
</LinearLayout>
</LinearLayout>
答案 1 :(得分:1)
你不能像这样使用时间戳字段。要么将timestamp字段强制转换为varchar,然后使用like或使用extract函数来匹配字段中的年份。