Query for filter based on date of birth.

34 views
Skip to first unread message

Pugazharasan Thirumalai

unread,
Sep 29, 2016, 7:03:33 AM9/29/16
to OrientDB
Hai,

Am trying to get list of upcoming birthday of the customer from the database but i can't get exact list from the database.

Thanks and Regards,
T.Pugazharasan

Oleksandr Gubchenko

unread,
Sep 29, 2016, 9:02:18 AM9/29/16
to OrientDB
What is your structure?
What query are you using?

Pugazharasan Thirumalai

unread,
Sep 29, 2016, 9:25:13 AM9/29/16
to OrientDB
Structure is '2015-12-06 00:00:00


Actually this query is work when from date is '2016-9-29' and to date up to '2016-12-31'

select dob, anniversary_date from (select expand(out('store_customer')) from #48:843) where is_deleted = 0 and in_store_customer['out = #48:843'].is_active = 1 and dob.format('MM-dd') between '09-29' to '12-31' desc skip 0 limit 11

but if my to date changes to next year  ie to '2017-01-31' that query is not working

select dob, anniversary_date from (select expand(out('store_customer')) from #48:843) where is_deleted = 0 and in_store_customer['out = #48:843'].is_active = 1 and dob.format('MM-dd') between '09-29' to '01-31' desc skip 0 limit 11

Oleksandr Gubchenko

unread,
Sep 29, 2016, 9:36:18 AM9/29/16
to OrientDB
Can you share your test DB ore describe your databases's schema, please?
What version are you using?

alessand...@gmail.com

unread,
Sep 29, 2016, 9:55:05 AM9/29/16
to OrientDB
Hi,
could you try with

select dob, anniversary_date from (select expand(out('store_customer')) from #48:843) where is_deleted = 0 and in_store_customer['out = #48:843'].is_active = 1 and dob.format('yyyy-MM-dd') between '2016-09-29' to '2017-01-31' desc skip 0 limit 11


Best regards,
Alessandro

Pugazharasan Thirumalai

unread,
Sep 29, 2016, 10:03:48 AM9/29/16
to orient-...@googlegroups.com
ya i tried it, but that query wont work at when my date of birth is '1988-07-23'

 In my database i have stored all customer date of birth , so i have list the upcoming date of birth from my database.

Pugazharasan Thirumalai

unread,
Sep 29, 2016, 10:11:06 AM9/29/16
to OrientDB
Am using version: orientdb-community-1.7.11-20141127.163804-2-distribution

Ivan Mainetti

unread,
Sep 29, 2016, 10:47:44 AM9/29/16
to OrientDB
orientdb {compleanni}> select from V

----+-----+-------------------
#   |@RID |dob                
----+-----+-------------------
0   |#9:9 |2016-03-29 00:00:00
1   |#9:10|2016-10-29 00:00:00
2   |#9:11|2016-11-29 00:00:00
3   |#9:12|2016-12-29 00:00:00
4   |#9:13|2016-01-29 00:00:00
----+-----+-------------------


orientdb {compleanni}> select * from v where dob.format('yyyy-MM-dd') between '2016-09-29' and '2017-01-31'

----+-----+-------------------
#   |@RID |dob                
----+-----+-------------------
0   |#9:10|2016-10-29 00:00:00
1   |#9:11|2016-11-29 00:00:00
2   |#9:12|2016-12-29 00:00:00
----+-----+-------------------

3 item(s) found. Query executed in 0.003 sec(s).


Using 1.7 version.

Though that's a really old version, I suggest you to update to the latest 2.2.10


Il giorno giovedì 29 settembre 2016 16:11:06 UTC+2, Pugazharasan Thirumalai ha scritto:
Am using version: orientdb-community-1.7.11-20141127.163804-2-distribution
Reply all
Reply to author
Forward
0 new messages