Database view - records created today in where clause
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2015 09:23 AM
I try to filter records created today, mixing in mysql functions in the where clause of the table
ct.sys_created_on > DATE_ADD(NOW(),INTERVAL -1 DAY) and ct.sys_created_on < DATE_ADD(NOW(),INTERVAL 1 DAY)
For some reason EMPTY created dates are returned and the join with my sys_user_group query where condition is not happening anymore
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2015 06:43 AM
Hi Tony,
The "where clause" you see in a database view in instance UI refers to a join condition, and it's not the real SQL WHERE clause. Currently you cannot add a real SQL WHERE clause in a database view (but you can filter a database view if you add it into a report).
An example will probably clarify what I mentioned above:
- example on MySQL on the join condition:
SELECT t1.name, t2.salary
FROM employee AS t1 INNER JOIN info AS t2 ON t1.name = t2.name;
- example on MySQL on the join condition plus a WHERE clause:
SELECT left_tbl.*
FROM left_tbl LEFT JOIN right_tbl ON left_tbl.id = right_tbl.id
WHERE right_tbl.id IS NULL;
Hope this helps.
Regards,
Sergiu