Get Count of a Delimeter
10g, RH Linux
I have a ^-delimited string as a col value. What's the best way to get the count of carets ( ^ ) in each string?
Thanks,
One way could be:
SQL> With T as(
2 Select 'asdkjh^^^^asdas^sdf!sdf^' c1 from dual union all
3 Select '23~^wtr^w3413sdf!sdf^' from dual union all
4 Select 'asdkjh^^32ert4^SGhh' from dual union all
5 Select '^^^^^^^^^^^^^^^^^^^' from dual union all
6 Select '121111111111123333' from dual )
7 Select C1,
8 length(c1) - nvl(length(replace(c1,'^',null)),0) "Caret Count" from T;
C1 Caret Count
asdkjh^^^^asdas^sdf!sdf^ 6
23~^wtr^w3413sdf!sdf^ 3
asdkjh^^32ert4^SGhh 3
^^^^^^^^^^^^^^^^^^^ 19
121111111111123333 0
SQL>
Similar Messages
-
Ordering of objects by more than one field and get counts
i have an object visit (personid, city, street, place, date)
A person could have visited a same place in the same strret in the same city several times on different dates.
I have a visits 'Set' for a person and I have to get a count of visits he has done to a place..
its basically select count(visits) group by city, street , place.
I know to use interface comparator for a single field.. how to compare multiple fields and get counts??
if you know abt where i can find information please let me know.
Thanks.For multiple fields, your comparator compares the most significant field first. If they're unequal, it returns +/- accordingly. If they're equal, then it moves on to the next field. And so on, until, finally, if all the relevant fields are equal, then the objects are equal.
Just like what you do when comparing, say, last names. If the first letters are unequal, you're done, else move onto the next letter, and so on..
For the count, you wouldn't use a comparator, as that's for sorting. Exactly how you do it depends on the details of what you're storing and how, which you haven't provided. -
How to get count of rows for a table?
Hi,
How to get count of rows for a table and secondly, how can i have access to a particular cell in a table?
Regards,
DevashishHi Devashish,
WdContext.node<Your_node_name>().size() will give you the no: of rows.
This should be the node that is bound to the table's datasource property.
WdContext.node<Your_node_name>().get<node_name>ElementAt(index_value); will select the row at that particular index.
You can access an attribute of a particular row as
WdContext.node<Your_node_name>().get<node_name>ElementAt(index_value).get<attribute_name>();
Hope this helps,
Best Regards,
Nibu.
Message was edited by: Nibu Wilson -
Can't get counter 2/3 working in simple event counting mode for NI6601
I have been successfully been able to get counter 0 and 1 working in a simple event counting mode. But when I read Software Save register for counter2/3 it gives me garbage values. I am doing register level programming in C.
This is the algorithm that I follow
In initialization:
-> Reset the Counter
-> Write32( Clock_Config_Reg, 0x00)
-> Write Load A and LoadB registers
-> Write to Input Select Register with appropriate values
-> Write16( Command_Reg, 0x0125);
Then when I need to read the SW save register value
-> Write to Command Register setting the gi_Arm bit
-> Reading the SW save register twice
-> If not equal ,read again
-> Write to Command Register disabling the gi_Arm bit
This works just fine for counter 0 and 1. But I can't get it working for counter 2 and 3. Are there any other registers I need to set up correctly for counter2/3. Is the default reset values of registers different for counter 2 and 3?
Any help would be very appreciated
ThanksHello manisha,
Is there a particular reason for using register level programming to interact with your DAQ card, rather than the DAQmx driver? The reason I ask is because we don't support RLP at NI. There are some manuals that have been developed, such as this one which corresponds to your card, but I am unable to offer any support after that. If it is necessary that you must use RLP then you should post your question to the DDK forum, as they have more experience in this area.
Regards, -
Get-Counter path is not correct
I'm to get this to run but keep getting this error: Get-Counter : The specified counter path could not be interpreted.
Any insight into this issue would be appreciated.
param($destserver, $destDB)
$destserver = "CCIIT23"
$destDB = "SSIMS_Prod"
$Servers = Get-SqlData $destserver $destDb "Select ServerName From ServerNames"
write-output $Servers
$CounterList = Get-SqlData $destserver $destDb "Select Counter From MemoryCounterList"
write-output $CounterList
$Servers | Foreach-Object {
$Serv = $_; $CounterList | Foreach-Object {
Get-Counter -Computer $Serv -Counter $_ -SampleInterval 1Hi ClayRP,
I'm not sure about the function Get-SqlData, However, Please make sure you have the right input format of the parameter -Counter in the cmdlet Get-Counter with "[\\<ComputerName>]\<CounterSet>(<Instance>)\<CounterName>".
To get the right counter example of Memory Counter set, try to run the cmdlet below:
(Get-Counter -ListSet memory).paths
I hope this helps. -
Getting Counts with single query
HI,
I need help in writing a query that gets account counts in a single query,
CREATE TABLE ACCOUNTINFO(
ACCOUNTID VARCHAR2(20 BYTE) NOT NULL,
ACCOUNTNO VARCHAR2(10 BYTE) NOT NULL,
LAST_DEPOSIT_DATE DATE,
BALANCE NUMBER(10,0));
I have a table like above and I am trying to write a query that gets
Count of accounts with deposits made in last 1 month,
Count of accounts with deposits made in last 2 months
Account Count with balance > 0,
Also, I need to join this ACCOUNTINFO with ACCOUNTMAIN to get name etc details
CREATE TABLE ACCOUNTINFO(
EMPID VARCHAR2(20 BYTE) NOT NULL,
FNAME VARCHAR2(30 BYTE) NOT NULL,
MNAME VARCHAR2(30 BYTE),
LNAME VARCHAR2(30 BYTE) NOT NULL,
DOB DATE,
ACCOUNTID VARCHAR2(20 BYTE));
Question, how to write a query since I getting too-many counts (I have only 3 in sample above, actual goes on like 3-6, 6-9 etc).SELECT SUM (CASE WHEN LAST_DEPOSIT>=ADD_MONTHS(SYSDATE,-1) THEN
1
ELSE
0
END
) COUNT_LAST_MONTH,
SUM (CASE WHEN LAST_DEPOSIT>=ADD_MONTHS(SYSDATE,-2) THEN
1
ELSE
0
END
) COUNT_LAST_TWO_MONTHS,
SUM (CASE WHEN BALANCE>0 THEN
1
ELSE
0
END
) COUNT_BALANCE_GREATER_ZERO
FROM ACCOUNTINFO -
How to get count,index and compare to arraylists
hi
how to get count,index and comparing of 2 arraylist.... plz suggest me asap...How is your question related to JDBC? And what have you done so far with your code?
-
How to get count of group of current login user if AD Group is added in SharePoint Group?
My Client has 2 SharePoint Application. For the AD Users they have created AD Group and added users in that AD Group as per requirement. Later AD Group is added in SharePoint Group. When I'm trying to fetch Current User Group count, I can able to get the
count of Groups using below statement.
int groupCount = SPContext.Current.Web.CurrentUser.Groups.Count;
Above Statement, returns always 0 value if I tried with User who are added in AD Group and if I add AD User and then it will return the exact count.
Please suggest solution to get Count of Group of Current User. My Application contains more than 60 SharePoint group.Hello,
I believe your code doesn't count those AD group users until they login at least once. If this is the case then try to use "SPUtility.GetPrincipalsInGroup" as suggested in below post:
http://stackoverflow.com/questions/4314767/getting-members-of-an-ad-domain-group-using-sharepoint-api
Hemendra:Yesterday is just a memory,Tomorrow we may never see
Please remember to mark the replies as answers if they help and unmark them if they provide no help -
How to get count of all records of all entities in CRM Online
Hi,
I want to get count of all records entitywise in dynamics CRM 2013 online. I know we can count the records in CRM on-premise using a SQL query in report. Earlier I wrote a SSRS report to count the records in a CRM entity wise as displayed in
the screenshot below..
Can someone suggest me a good approach to implement the same in CRM Online.
Thanks
Pratibha SinghHello,
In a CRM Online environment, you need to create reports based on Fetch XML. Take a look at this link to create a Fetch XML query with aggregates: https://msdn.microsoft.com/en-us/library/gg309565.aspx?f=255&MSPPError=-2147217396#count .
Here is an example to create a report in an online environment: http://edwardsdna.com/2012/12/03/crmonline-report/
Hope it helps,
Kind regards -
How to get count as 0 for records not in table
Hi All,
I have requirement where I need count of records in the table based on ids. Example query below
SELECT empid ,
nvl(COUNT(id), 0) empcount
FROM employee
WHERE empid IN(1, 2, 4, 5)
GROUP BY empid
In the table only record for "empid=2" is present so I get count 1 for it. But with it I should get count as 0 for non existing records. Expecting below output
empid | empcount
1 | 0
2 | 1
4 | 0
5 | 0
Appreciate your help and Thanks in advance.
Regards.
Ashishe.g.
SQL> select column_value deptno, count (deptno)
from emp, table (sys.odcinumberlist (10, 20, 100))
where deptno(+) = column_value
group by column_value
DEPTNO COUNT(DEPTNO)
10 3
20 5
100 0
3 rows selected. -
Get Counts Fails in Siebel Analytics 7.8 Segmentation Manager
Get Count function in Segmentation Manager fails with bellow error :
"GetCount" failed.Assertion failure: nTasks <= MAXIMUM_WAIT_OBJECTS at line 65
of ./project/webthreads/windows/winfuturetask.cppSET VARIABLE
Where do I increse the value for "MAXIMUM_WAIT_OBJECTS " parameter?
The Rollup segment we are trying to update the counts contains lots of nested segments.
Thanks in advance for your help,
RaviUse current_date.
mark if helps
~ http://cool-bi.com -
I have the following code:
Import-Module "sqlps" -DisableNameChecking
#####http://www.travisgan.com/2013/03/powershell-and-performance-monitor.html
function ExtractPerfmonData
param(
[string]$server,
[string]$instance
[Microsoft.PowerShell.Commands.GetCounter.PerformanceCounterSampleSet]$collections
$monitorServer = "MonitoringServerNameHere"
$monitorDB = "MonitoringDatabaseNameHere"
$counters = @(
"\$($instance):Memory Manager\Memory Grants Pending",
"\$($instance):Memory Manager\Target Server Memory (KB)",
"\$($instance):Memory Manager\Total Server Memory (KB)",
"\$($instance):Buffer Manager\Buffer Cache Hit Ratio",
"\$($instance):Buffer Manager\Checkpoint pages/sec",
"\$($instance):Buffer Manager\Page Life Expectancy",
"\$($instance):General Statistics\User Connections",
"\$($instance):General Statistics\Processes Blocked",
"\$($instance):Access Methods\Page Splits/sec",
"\$($instance):SQL Statistics\Batch Requests/sec",
"\$($instance):SQL Statistics\SQL Compilations/sec",
"\$($instance):SQL Statistics\SQL Re-Compilations/sec",
"\$($instance):Locks(_Total)\Lock Waits/sec"
$collections = Get-Counter -ComputerName $server -Counter $counters -SampleInterval 1 -MaxSamples 1
$sampling = $collections.CounterSamples | Select-Object -Property TimeStamp, Path, Cookedvalue
$xmlString = $sampling | ConvertTo-Xml -As String
$query = "dbo.usp_InsertPerfmonCounters_SQLServer '$xmlString';"
Invoke-Sqlcmd -ServerInstance $monitorServer -Database $monitorDB -Query $query
#####ExtractPerfmonData -server "YourRemoteServerName" -instance "MSSQL`$SQLTest"
ExtractPerfmonData -server "ServerName1Here" -instance "SQLSERVER"
ExtractPerfmonData -server "ServerName2Here" -instance "SQLSERVER"
ExtractPerfmonData -server "ServerName3Here" -instance "MSSQL`$InstanceNameHere"
ExtractPerfmonData -server "ServerName4Here" -instance "SQLSERVER"
(I have 93 instances listed; here I just gave a sample of 4.)
For only one instance I get the following error message:
Get-Counter : The
\\ServerNameHere2\\SQLSERVER:Locks(_Total)\Lock Waits/sec performance counter path is not valid.
All of the instances should have been set up the same, so I am confused as to why this error only occurs on this one instance. I do not know where to look. Has anyone ever seen this type of error before?
lcerniHere is the output of the first script:
CounterSetName
... (eliminating non sql server counters here)
SQLAgent:Alerts
SQLAgent:Jobs
SQLAgent:JobSteps
SQLAgent:Statistics
SQLServer:Access Methods
SQLServer:Availability Replica SQLServer:Backup Device
SQLServer:Batch Resp Statistics
SQLServer:Broker Activation
SQLServer:Broker Statistics
SQLServer:Broker TO Statistics
SQLServer:Broker/DBM Transport
SQLServer:Buffer Manager
SQLServer:Buffer Node
SQLServer:Catalog Metadata
SQLServer:CLR
SQLServer:Cursor Manager by Type
SQLServer:Cursor Manager Total
SQLServer:Database Mirroring
SQLServer:Database Replica
SQLServer:Databases
SQLServer:Deprecated Features
SQLServer:Exec Statistics
SQLServer:FileTable
SQLServer:General Statistics
SQLServer:Latches
SQLServer:Locks
SQLServer:Memory Broker Clerks
SQLServer:Memory Manager
SQLServer:Memory Node
SQLServer:Plan Cache
SQLServer:Query Execution
SQLServer:Replication Agents
SQLServer:Replication Dist.
SQLServer:Replication Logreader
SQLServer:Replication Merge
SQLServer:Replication Snapshot
SQLServer:Resource Pool Stats
SQLServer:SQL Errors
SQLServer:SQL Statistics
SQLServer:Transactions
SQLServer:User Settable
SQLServer:Wait Statistics
SQLServer:Workload Group Stats
... (eliminating non sql server counters here)
lcerni -
WMI powershell - Get-Counter vs Specific Performance Classes
Hi,
As i see there are more than one way to get the Performance information in windows using Powershell.
I could use the Get-Counter cmdlet to fetch information about Processor,Disk or Memory.
While there are also specific WMI classes for Performance like Win32_Perf,Win32_PerfRawData,Win32_PerfFormattedData.
How does one decide which is the right way or which provides a more accurate value.
Thanks for helping me understand.It all depends on wwhat youo are tring to do.
Get-Counter and WMI do the samme thing. Raw couters are not often useful.
Start here:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa373083(v=vs.85).aspx
¯\_(ツ)_/¯ -
I am doing a report in ORACLE REPORT WRITER. How can I get counts for each SSN. I want to check the last 7 SSNS
and if the competence codes are different get a count for them. If the fitness codes are different get a count for them. This is for each SSN. Sometimes SSNS may have different competence codes but the fitness codes are the same. I still need counts for the competence codes. Other times the SSNS have different fitness codes but the competence codes are the same and I need counts for the fitness codes. Other times the fitness codes are different and the competence codes are different and I need counts for the fitness codes and counts for the competence codes. Here is a sample of what the report should look like:
SSN TOTAL TOTAL
Competence Fitness
000000111 13 6
000000222 6 0
000000333 0 7
I have everything wrapped up under one count. I don't know to change the query to display 2 separate counts.
I have used Summary Columns but that does not work.
I could use 2 separate querys and get counts for competence and fitness respectively but the SSNS would be out of order. The SSNS must be in order.
Here is the query.
SELECT DISTINCT T2.IND_SSN, COUNT(*)cnt1
FROM (SELECT distinct(t.ind_ssn), t.ind_competence_rtg_old, t.ind_competence_rtg_new, ROW_NUMBER()
OVER (PARTITION BY t.ind_ssn ORDER BY t.IND_SSN ASC, t.ind_er_per_end_dt DESC) rn
FROM NCOER_JRNL T) t2
WHERE t2.rn <= 7
and (t2.ind_competence_rtg_old <> t2.ind_competence_rtg_new)
GROUP BY T2.IND_SSN
UNION
SELECT DISTINCT T2.IND_SSN, COUNT(*)cnt2
FROM (SELECT distinct(t.ind_ssn), t.ind_FIT_rtg_old, t.ind_FIT_rtg_new, ROW_NUMBER()
OVER (PARTITION BY t.ind_ssn ORDER BY t.IND_SSN ASC, t.ind_er_per_end_dt DESC) rn
FROM NCOER_JRNL T) t2
WHERE t2.rn <= 7
and (t2.ind_FIT_rtg_old <> t2.ind_FIT_rtg_new)
GROUP BY T2.IND_SSN
ORDER BY 1Thanks for you reply Ricardo. It does work (but only if select 1 ticket).
My bad I only posted one Ticket Number. Actually there are lots of them ( as below). Your code take all the tickets as one tickets.
TicketNumber
OwningTeam
Status
Date
Team Number
123
TEAM 1
Pick Up
11/12/2014
1
123
TEAM 1
Complete
11/12/2014
1
123
TEAM 2
Pick Up
11/12/2014
2
123
TEAM 2
Complete
11/12/2014
2
123
TEAM 2
Resolve
11/17/2014
2
123
TEAM 2
Complete
11/24/2014
2
123
TEAM 2
Pick Up
12/8/2014
2
123
TEAM 2
Complete
12/9/2014
2
123
TEAM 2
Provide Info
12/17/2014
2
123
TEAM 1
Pick Up
1/8/2015
3
123
TEAM 1
Resoved
1/8/2015
3
456
TEAM 1
Pick Up
11/12/2014
1
456
TEAM 1
Complete
11/12/2014
1
456
TEAM 2
Complete
11/24/2014
2
456
TEAM 2
Pick Up
12/8/2014
2
456
TEAM 2
Complete
12/9/2014
2
456
TEAM 3
Pick Up
12/17/2014
3
456
TEAM 3
Working
12/18/2014
3
456
TEAM 1
Pick Up
1/8/2015
4
456
TEAM 1
Resoved
1/8/2015
4
789
TEAM 1
Pick Up
11/12/2014
1
789
TEAM 1
Complete
11/12/2014
1
789
TEAM 2
Complete
11/24/2014
2
789
TEAM 2
Pick Up
12/8/2014
2
789
TEAM 2
Complete
12/9/2014
2
789
TEAM 1
Complete
12/12/2014
3
Any work around is really appreciated.
Thanks,
Rajneet -
Any FM to get count of each week day for the given date range
Hi guys,
Any FM to get count of each week day for the given date range?
eg: If i give 14/07/2008 to 14/08/2008
I need to find how many Mondays, tuesdays...sundays in this given date range.
If not single FM is available, any logic that gives above result is also appreciated.
Thanks,
Vinod.hi Vinod,
this is not a full solution, I just give you a basic idea:
DATA : lv_start TYPE sy-datum VALUE '20080714',
lv_end TYPE sy-datum VALUE '20080814'.
WHILE lv_start LE lv_end.
CALL FUNCTION 'FTR_DAY_GET_TEXT'
EXPORTING
pi_date = lv_start.
* IMPORTING
* PE_DAY_TEXT1 =
* PE_DAY_TEXT2 =
* PE_DAY =
* you have to summarize the output here somehow...
lv_start = lv_start + 1.
ENDWHILE.
hope this helps
ec
Maybe you are looking for
-
How do i share media (music and videos) between all of my devices?
i currently have (and attempt to use as much as possible) the following devices: macbook pro 15", ipad 4, iphone 6 plus 64 GB, and appletv 2. i would love it if these devices would talk to each other correctly. first came the macbook, and i took an
-
Difference between user_sy_privs and session_privs views
Hi, could you tell me exactly if the difference between the user_sy_privs view and the session_privs view is this one -the user_sy_privs shows the system privileges the current user is really using during its session -the session_privs view shows the
-
Hi, Can any one help me on this issue, I am working production support. For quality cube if one of the notificationss 10044059 Problem Group is updated in sap. It is loading with updated record in the cube through ODs but when I execute the report i
-
Hi, on 11g R2 , UNIX, RAC our ASM is in RAC, 4 instances. I want to add a disk. My questions are : -should I issu : alter diskgroup data add disk 'D:\asmdisk\disk3'; on each instance ? Then four times ? -should I restart : startup mount each instance
-
Hi........ Like I am not Able to Create Recursive Node. it is giving Error. Type Comfortable. Please Tell Me solution ...