I want identical XPATH query to trhis SQL2 Query.
SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE([/content/abc/def]) and ([sling:resourceType] = 'geomatrixx/components/list' )
Is there any tool or link available through which i can convert sql2 query into xpath. or any tutorial if yes then please share the link
Below is the equilvalent XPath query.
/jcr:root/content/abc/def//element(*, cq:Page)[jcr:contains(jcr:content/#sling:resourceType, 'geometrixx/components/list')].
Below are some of the mappings between xpath and sql2 queries respectively.Taken from http://docs.jboss.org/jbossdna/0.7/manuals/reference/html/jcr-query-and-search.html.
//* SELECT * FROM [nt:base]
//element(*,my:type) SELECT * FROM [my:type]
//element(*,my:type)/#my:title SELECT [my:title] FROM [my:type]
//element(*,my:type)/(#my:title | #my:text) SELECT [my:title],[my:text] FROM [my:type]
//element(*,my:type)/(#my:title union #my:text) SELECT [my:title],[my:text] FROM [my:type]
Thanks,
Balaji
Related
How would I write a select all query in GraphSQ. Is Select * possible with introspection on?
Also did the syntax change as I see T. required in some versions?
query: """select * from "categories" where label = $1"""
or
query: """select T.* from "categories" T where T."label" = $1"""
In ElasticSearch using aggs you can easily replicate this sql query
SELECT COUNT(id) FROM table;
But I want this:
SELECT COUNT(id), id FROM table;
Or even better I want to do:
SELECT COUNT(price) * price FROM table;
Is this even possible in Elasticsearch?
I have tried “terms” and similar , using pipelines or bucket_script BUT the problem is doc_count is not accessible in buckets_path .
I have an issue with using Oracle's union and order by clauses together.
I have two complex queries (with sub queries in them) having an order by clause for each of them. I need to union the output of both and return the result. When I run it, I am getting the error ORA-00933: SQL command not properly ended.
But it works when I comment out the order by clauses in both of them.
To test this, I created a simple query as simple as shown below
select * from employee where employee_id=2 order by name
union
select * from employee where employee_id=3 order by name;
Even this gave the same error when ran with order by clauses but runs well when I commentout the order by clauses.
I tried searching forums, but I could not get solution for the exact problem. I found one at ORACLE Query with ORDER BY and UNION but As my queries are already too complecated because of subqueries and joins between too many tables, I dont want to implement this.
Can someone help me on fixing the root cause of the issue.
try this code:
select e1.name name /* e1.* */
from employee e1
where employee_id = 2
union
select
e2.name name /* e2.* */
from employee e2
where employee_id = 3
order by name;
if you want to order the result of first query then to order the result the second query so you can do like this:
select 1 query, e1.name name /* e1.* */
from employee e1
where employee_id = 2
union
select
2 query, e2.name name /* e2.* */
from employee e2
where employee_id = 3
order by query, name;
You can have only one ORDER BY when combining multiple queries, on the last statement. The ORDER BY clause acts on the entire set.
See the Oracle Documentation:
You cannot specify the order_by_clause in the subquery of these operators.
If you want order by in each query you must wrap it in other select as a subquery:
select * from (select * from employee where employee_id=2 order by name)
union
select * from (select * from employee where employee_id=3 order by name);
I have a query that used XML input to generate a XML table, I give that table an alias "XMLalias". How can I query this table in some other select statement, which is part of same batch.
I want to do something like " select * from XMLalias ".
I am new to oracle so please excuse if this is something really simple.
thanks.
im not sure what you need exactly as i figure what you want is one of this two:
select * from
(select * from XMLalias ) insider
where insider.col1 /*.....*/
Or you wanted someting like that
select *
from XMLalias a,
XMLalias b
where a.key_col=b.other_key_col
and a.col1 = /*...... */
and b.col2 = /*...... */
How do I select multiple rows from SQL?
ie. $results->row(1,2,3,4,5,10)
Are you using ActiveRecord? If so, you can use the where_in() method when making your query. It's not something you do after the query is finished, as you seem to be doing in your example.
$this->db->where_in('id', array(1,2,3,4,5,10));
$query = $this->db->get('myTable');
// This produces the query SELECT * FROM `myTable` WHERE `id` IN (1,2,3,4,5,10)
See the this CodeIgniter docs section for more info on SELECT statement support.