» Home » Query » Page 1
I need to combine 2 queries into one on query 1 area to query 2 description and query 1 empl to query 2 employee_id
Category : Databases

I have the following 2 queries and their output.

Query 1

types,area,avg(time2)as time,empl,whse,des
from(select l.control_number_2 as types, l.control_number as area,
sum(round(cast(DATEDIFF(ss, l.start_tran_time,l.end_tran_time) /60.0 as float),2))over (partition by l.control_number) time2, l.employee_id as empl, l.wh_id as whse ,

View Replies

How to detect an entered search query as a surround query or as a normal lucene core library query
Category : Coding

Is there a way where we can find out whether a query is for the normal lucene core library or for the surround contrib module. Can we merge a surround queryparser with the lucene core library's queryparser, so that we have only one queryparser which detects a syntax as a surround query or the normal lucene query.

View Replies

MongoDB, how to create index for query containing a geospatial query, a range query and sort on different columns?
Category : Coding

So if I have a query that does the following (in pseudo code)

find(a nearby x, b > y).sort(c)

where a is a geo column, b is type of long, and c is also a type of long

Would the compound index on (a:2d, b:1, c:1) work and suggested?

View Replies

Search query slow down performance due to lots of records in product table , please provide nice query in sql server to optimize given query
Category : Coding
SELECT distinct tb_Ecomm_Product.SKU as ImageName,
tb_Ecomm_Product.Name AS PName,
(Case When (SalePrice Is Not Null And SalePrice!=0) Then

View Replies

CTE query plan for complex query - triple run of the same init query - why?
Category : Databases

It's difficult to explain, but I'll try.

As you see on query_plan picture attached (It is query plan for "All in one place" query described below), there are 3 almost the same "blocks" - my question is WHY? It seems to me that when I have "all in one" (see below) query the "Init" block (that is rather heavy) is run three times with different filters instead of being SPOOLED a

View Replies

In sync query calls, one query causing other query to run slower. Why?
Category : Databases

Sorry for the long question, but I think this is an interesting situation and I couldn't find any explanations for it:

I was involved in optimization of an application that performed a large number of sequential SELECT and INSERT statements on a single dedicated SQL Server database.

The process needs to INSERT a large number of records into a table, but for each of them

View Replies

Incomprehensible query result looking for rows in a query which are not in other query
Category : Databases

I'm gettintg crazy with the result of this query

This query returns 29.970 rows (distinct IdDireccionIne):

select distinct IdDireccionIne from DireccionIne as DI

This query returns 29.544 rows (distinct IdDireccionIne):

select distinct IdDireccionIne from DireccionCorregida
where IdDireccionIne is not null

View Replies

MySQL Sub Query join query to exisiting query
Category : Databases

I have a query, and I'm looking for a way to do a subquery and have the results joined as the last column

Something like this :
My current query works and is similar to this:

SELECT * FROM users_table JOIN randomjoin here WHERE blah

The second query that I run and would like to integrate into the first query is:


View Replies

Oracle SQL Sub-Query how to use result from query A to restrict query B
Category : Programming Languages


Combine two queries I currently run.
Have the WEEK from query 1 be a filtering criteria for query 2.

Query 1:

-- ************************************************
-- Accounts Recieveable (WEEKLY) snapshot
-- ************************************************

View Replies

'LINQ query plan' horribly inefficient but 'Query Analyser query plan' is perfect for same SQL!
Category : Databases

I have a LINQ to SQL query that generates the following SQL :

exec sp_executesql N'SELECT COUNT(*) AS [value]
FROM [dbo].[SessionVisit] AS [t0]
WHERE ([t0].[VisitedStore] = @p0) AND (NOT ([t0].[Bot] = 1)) AND
([t0].[SessionDate] > @p1)',N'@p0 int,@p1 datetime',
@p0=1,@p1='2010-02-15 01:24:00'

(This is the actual SQL taken from SQL Prof

View Replies

2012 / 2017 Copyrights BigHow , All Rights Reserved .