Hi,
We are selecting values from two columns which does not include primary key or unique & binding it to drop down and thus getting multiple values in dropdown.
The code snippet is:
ctx.students = xtk.queryDef.create(
<queryDef schema="stf:student" operation="select">
<select>
<node expr="@firstname"/>
<node expr="@lastname"/>
</select>
<orderBy>
<node expr="@firstname" sortDesc="false"/>
</orderBy>
</queryDef>).ExecuteQuery();
How can we can fetch only DISTINCT records?
Thanks
Sachin
Solved! Go to Solution.
Hi Scahin,
Use the method Countdistinct()
for example:
var query = xtk.queryDef.create(<queryDef schema="nms:broadLogRcp" operation="select">
<select>
<node expr="Countdistinct(@account_id)" alias="total"/>
</select>
<where>
<condition boolOperator="AND" expr={("@status = '1'")}/>
</where>
</queryDef>).ExecuteQuery();
var results = query.broadLogRcp;
logInfo("results count= " +results.total);
This should work...
Happy campaigning
Sumit
Set the attribute district to "true".
<queryDef schema="stf:student" operation="select" distinct="true">
For me is not working distinct="true" !!!
var query = xtk.queryDef.create(<queryDef schema="nms:broadLogRcp" distinct="true" operation="select">
<select>
<node expr="count(@account_id)" alias="total"/>
</select>
<where>
<condition boolOperator="AND" expr={("@status = '1'")}/>
</where>
</queryDef>).ExecuteQuery();
var results = query.broadLogRcp;
logInfo("results count= " +results.total);
I have the same number for "totalC" if I run the query with distinct="true" or without it.
Can somebody explain why?
Thank you!
Views
Replies
Total Likes
Hi Scahin,
Use the method Countdistinct()
for example:
var query = xtk.queryDef.create(<queryDef schema="nms:broadLogRcp" operation="select">
<select>
<node expr="Countdistinct(@account_id)" alias="total"/>
</select>
<where>
<condition boolOperator="AND" expr={("@status = '1'")}/>
</where>
</queryDef>).ExecuteQuery();
var results = query.broadLogRcp;
logInfo("results count= " +results.total);
This should work...
Happy campaigning
Sumit
Sorry the reply was for bianca78
Views
Replies
Total Likes
Thank you very much!!!
Views
Replies
Total Likes
Views
Likes
Replies