Can someone please tell me how to create a query to show something older than 1 year without using DATE_ADD because I guess this function is used just in doctrine2?
Something like Where (DateField > (GetDate() + 365)) should work.
Related
I am trying to relieve data from my database that will only return data that will be due in the next 6 months.
In my controller, this is how I query my database.
$critical = infrastructure::where("inf_lifspan",">", Carbon::now()->subMonths(6))->get();
The results is shown below.
Can someone point me in the right direction what I did wrong?
Thanks.
Thanks guys, I got the answer. I just need to change the > sign to < sign.
$critical = infrastructure::whereDate('inf_lifspan','<', Carbon::now()->addMonths(6))->get();
How I can get the next year from now?
1.year.from_now
I need to get only 2019 as a result from the above code.
Use Time.now.next_year (activesupport needed) and if you want only year then go with Time.now.year + 1
Other option
require 'date'
Date.today.next_year.year
1.year.from_now.year
does the job.
Any expression returns now + .next_year + .year
Time.now.next_year.year
Date.current.next_year.year
DateTime.current.next_year.year
etc. and all others solutions proposed.
I hope it useful for you. :)
Use this code: DateTime.now.year + 1
I have a challenge with SSRS 2012. I have 1 parameter in which I need to be able to select multiple values from 3 different columns. I was only able to make this work with selecting 1 value, then it would look at all columns and return the value. However, I am not sure how I can accomplish this with multiple values.
This is the expression that makes it work with 1 parameter and 1 value for 3 columns. I tried using IN instead of =, but to no avail.
WHERE (Customer_Category1 = #prmCategory OR Customer_Category2 = #prmCategory OR Customer_Category3 = #prmCategory)
I have researched for hours without finding any information.
Please help if you can. I'm open for any suggestions or recommendations. I am still pretty new at the parameter realm.
Using in should be the solution here. However, it is possible that your syntax was not correct. Try this:
WHERE (Customer_Category1 in (#prmCategory) OR Customer_Category2 in (#prmCategory) OR Customer_Category3 in (#prmCategory))
So I would like to know what now-1y is producing as a result. So is it:
now - 365days
now - 365.25days
now with the year part subtracted, so 2014-12-23T08:46:00
I've read this documentation but can't find any more information.
After some testing it appears that the third proposition is correct (ie "now with the year part subtracted, so 2014-12-23T08:46:00"
If 2 was correct the following example should have return 2 results.
example1
As 2012 is a leap year. The following example should return 0 result if 1 was correct.
example2
Note: example only worked as expected when I wrote this answer, in order to make it work for you, you have to update the date field of the indexed document.
I've got a strange behaviour on a German surname "Warsoenke".
Check this out:
create table test_warsoe
as
select 'Mister Warsoenke ABC-12' name
from dual;
create index test_warsoe_index on test_warsoe(name) indextype is ctxsys.context;
select name,
score(1) as rating_warsoe,
score(2) as rating_warsoen
from test_warsoe
where contains(name,'definescore(Warsoe%,occurrence)',1) > 0
or contains(name,'definescore(Warsoen%,occurrence)',2) > 0;
The output is:
Mister Warsoenke ABC-12 | 2 | 1
I cannot figure out why? If I type "Warsoe" or "War" it returns score 2. If I type "Warsoen" it works like, as I understand, it should and returns 1.
If I do not use definescore it works in the same direction, just shows different numbers (27 and 13).
For other surnames it works perfectly and clear. But for this one...
I had a guess this is because of German database settings, e.g. "War so e..." but this idea is quite strange and still it is not clear why "Warsoen" works then.
Any ideas?
EDIT
I've found out much more surnames which are not working like the described above. And I still do not see any possible explanation of this...
Just if somebody has the same problem, the problem was in setting of DEFAULT_LEXER:
BASE_LETTER | YES
ALTERNATE_SPELLING | GERMAN
That's what we received after investigation:
To change the behaviour, either one of the two parameters have to be changed, or the additional parameter OVERRIDE_BASE_LETTER has to be set to true (according to docs).