query

SQL Query / Xml

I'm trying to query a table which has a column that contains straight xml data. Within the query I'm querying columns that hold straight data (int, vchar etc) but I'm also querying the xml column. In the xml column i want to grab a value within the xml and return null if it doesn't exist. I have the following query that almost works b...

How to query PDF in Solr?

I added PDF document to Solr curl "http://localhost:8983/solr/update/extract?literal.id=doc2&captureAttr=true&defaultField=text&fmap.div=foo_t&capture=div" -F "[email protected]" and I would like to query it for word "errors" http://localhost:8983/solr/select/?q=errors&version=2.2&start=0&rows=10&indent...

SQL Server Insert Query on Fact Table

Okay, so I have this problem with my Fact Table. I need it to automatically be filled when a new data is entered on all the other tables in the database which has a foreign key on my Fact Table. In my stored procedure, I compiled all the insert statements I have and at the end, since I also want to update my Fact Table, I place this quer...

how to optimizing boolean function?

hi im facing the challange of optimizing a database design by an automated mechanism. the database will include tables which relates arbitrary data to an attribute e.g. Table A contains all id's of persons who clicked the buy button, Table B contains all id's who have no chargeback, .... so given are some very basic MainTables e.g. A,B...

Any optimization Idea for this SQL (mySQL)?

I know the best way would be not to have any sql inside other sql, specially a complicated one, and would be better to use the analysis after the query, but because the way the system is build I would preffer to do it only on one query Here is the query in question ("is a really cool query") SELECT DISTINCT o.orders_id, o.faltantes...

How to get Result from database by order the condition put in "IN" clause?

Sorry for bad english. bfproduct is a table and productid is primary key in this table and productname is another field defined in this table. When i execute this query, select * from bfproduct where productid in (23,5,54,3132,32). The result is as follows: productid | productname 5 15 Park Avenue 23 Good Boy Bad Bo...

Sql Excution Plan Shows Different result for same inputs

declare @name varchar(156) set @name ='sara' --Query 1: SELECT [PNAME] FROM [tbltest] where [PNAME] like '%'+@name+'%' --Query 2: SELECT [PNAME] FROM [tbltest] where [PNAME] like '%sara%' suppose that there is a NoneClustered Index on [PNAME] column of [tbltest]. when running Queries, Excution plan show index Seek For Query 1 an...

dynamically populate a third dropdownlist by two independent (not cascading) dropdown lists

Hi I have two dropdown lists (one dynamically populated, the other not) that determine the values of a third dropdown list. The idea is that the first ddl1 is compulsory and ddl2 is optional. How can I get the null value (is not value is selected) of ddl2 once ddl1 value is selected. Thanks! <asp:SqlDataSource ID="SqlDataSource1" r...

Help with sql query

Hello guys need help with a query. Consider the following table I need to select first the sum of each Code from table. I am doing it with simple sum and group by statement. Then I have to subtract the results from each code sum where type='r' 1)Say for first part of query, we will get 2 rows from SUM (one with total USD and one with...

Adding a SUM Column to a Query

I'm trying to do a query that returns the information of a purchase bill, but also there's another table that has detail of the bill, but I need to add that total to the other query, but I can't add the column, because it says that I need to have in the group by the same objects that in the select, and I tried it this way, but it says th...

SQL Query - SELECT all rows except where value in column begins with 402 or 403 or A40

I have a (MS) SQL VIEW with no control over and it also queries several other SQL VIEWs that I also have no control over but must use. Get all rows based on "pilot" value except where it starts with 402 or 403, or A40. This is the current query that works fine as long as all "pilot" entries are possible to interpret as INT. SELECT * fr...

How can I see queries that are executed against Oracle ?

Hi, I need to see the queries that are being sent to Oracle to execute them. Can someone give me specific detailed instructions on how to do this ? ...

crystal reports query

This is my current query to pull data out of an Access Database: SELECT Count(Master.MasterID) AS Logs FROM Master WHERE (((Master.SubmitDate)<=#5/01/2010#) AND (((Master.CompleteDate)>=#5/01/2010# Or (Master.CompleteDate) Is Null))); Currently I have to change the date for each month I want to find the count for. I am trying to migra...

sqlite: how to find all rows in a table where ANY of the columns are null?

I have a very large CSV file that I imported into a sqlite table. There are over 50 columns and I'd like to find all rows where any of the columns are null. Is this even possible? I'm just trying to save myself the time of writing out all of the 50 different columns in a where clause. Thanks. ...

How do I write a named scope to filter by all of an array passed in, and not just by matching one element (using IN)

I have two models, Project and Category, which have a many-to-many relationship between them. The Project model is very simple: class Project < ActiveRecord::Base has_and_belongs_to_many :categories scope :in_categories, lambda { |categories| joins(:categories). where("categories.id in (?)", categories.collect(&:to_i)) } ...

Using Language neutral fields in full text query!

Hi all, I have a table which hold multiple languages(English, French, Arabic, German). I also have full text index on the table. I also have two meta date fields that are independent of the languages. So for all the languages I need to query these fields. I have kept the meta data field as language neutral. But when I query the index us...

is there a tricky way to optimize this query

I'm working on a table that has 3008698 rows exam_date is a DATE field. But queries I run want to match only the month part. So what I do is: select * from my_big_table where to_number(to_char(exam_date, 'MM')) = 5; which I believe takes long because of function on the column. Is there a way to avoid this and make it faster? other ...

Sitecore query does not support count() function?

Sitecore query is based on XPATH, but looks like it does not support count() function. My query is this: ../*[@@templatekey='topic' and count(child::*) > 0] But gives me "Object reference not set to an instance of an object." error. But if I remove the count() filter, works just fine... Any idea why it doesn't like count? ...

how to receive fast result from access query ?

hi i have table (MyTbl) that has 3 field's A,B,C this table contain 800000 records. what is the best way to receive fast result ? i try this: select top 1 A from MyTbl where A='123' but it isn't fast i work with Access 2007 - and C# program ...

Help with SQL Query

Hello guys, consider the following example. I have to select all the records from table1 which exist in table2 also + all the records from table2 which don't exist in table1 but exist in table2 and have IsActive=1 and status not null. I initially tried it with a join but how to do the later part where I have to select the records whic...