Adding a number to a column with a value in it Access - sql

Ok So I have A column with a count IIF expressions As shown:
UNTESTED: Count(IIf([TEST]="UNTESTED",1))
What I want to do is now look at where the location was and when the test was done and if in a specific location and YEAR then add 8 to that value I am now trying to use:
UNTESTED: Count(IIf([TEST]="UNTESTED",1)) AND IIf([REGION]="CANADA" And [YEAR]<=2012,[UNTESTED]+8,[UNTESTED])
Thanks in advance if you can solve this!

Here is the Answer to my question, I solved it :
IIf([Site]="CANADA" Or [Site]="ALASKA",IIf([Year]<"2013",Count(IIf([Pass_Fail]="UNTESTED",1))+8,
Count(IIf([Pass_Fail]="UNTESTED",1))),Count(IIf([Pass_Fail]="UNTESTED",1)))

Related

Array stored as String - How to extract pieces of it?

I got a problem with a specific database where some tags from a user profile are stored as a String data type, and so far I have not figured out how to fetch data from this one.
Example String:
{"watch_intro": "Gifts from my family.", "favorite_brands_styles": ["Fossil","Tudor","Omega"]}
I am looking to query into this field and get something like below:
'Fossil, Tudor, Omega'
Any help would be appreciated, thanks.
Nevermind, found the answer:
array_to_string(PARSE_JSON(EXTRA_INFO):"favorite_brands_styles",', ') AS fav_brands

show all unique value from column

I try to show all value from a dataframe column with this code combinaison_df['coalesce'].unique()
but I got this result :
array([1.12440191, 0.54054054, 0.67510549, ..., 1.011378 , 1.39026812,
1.99637024])
I need to see all the values. Do you have an idea to do?
Thanks
If I have this situation but don't want to change it for every print() statement I found this solution with a context manager quite handy:
with pd.option_context('display.max_rows', None):
print(combinaison_df['coalesce'].unique())

Exclude Value form Dimension

I have this set analysis sentence:
=if(aggr(Rank(Count(WordCounter)),Word)<=70,Word)
I have a request to remove "Among" from the Word data.
Any suggestion?
This is the solution optimal:
=if(aggr(Rank(Count {<Word-={'Among'}>}(WordCounter)),Word)<=70,Word)
Try :
=if(aggr(Rank(Count(WordCounter)),if(Word <> 'Among', Word))<=70,Word)

Regex in redshift

I have a problem.. I need to extract from this field:
exchange<=><br>type<=>full<br>cont<=>part<br>req<=>no<br>money<=>money<br>money<=>3100,4000,0,month<br>boss<=>0
five informations:
full
part
3100
4.4000
5.month
I have tried to use regexp_substr():
regexp_substr(column,'type<=>[^<br>]*') but I dont have any knowledge about regex and I cant do it in a properly way.. can you help me with that?
I never worked with redshift but with regex I can help you:
"(type|cont|money)<=>([^<,]+)(,([^<,]+),[^<,]+,([^<,]+))?"
The capture number 4 in the string you put as an example it will capture all you need, it even exclude the 0 :
Group 1: money
Group 2: 3100
Group 3: ,4000,0,month
Group 4: 4000
Group 5: month
In case you have problems, tell me.
If you want to master your regex skills I can teach you, it will be useful.

Ms Access Syntax issues

My problem is that I would like to realize this, but it throws syntax error.
WorkDayUltimate: Format(DateAdd("mm/dd/yy","h",-6,[Outgoing Date])
Thanks for your help in advance.
You must first add to date, then format:
WorkDayUltimate: Format(DateAdd("h",-6,[Outgoing Date]),"mm/dd/yy")