query

On MongoDB, how do I filter out documents where a field with an array of strings includes a certain string?

For example, I can have documents like: doc1 = { title: "First blog post", tags: ["family", "sensitive", "private"] } doc2 = { title: "Second blog post", tags: ["travel", "photos"] } And I would like to list all posts that don't contain the "private" tag (in the se above, that would return only doc2). I've tried doing this: ...

SQL Server Find out default value of a column with a query

How can I find out the default value of a column in a table using a SQL query? Using the sp: sp_columns @tablename I get some info on the columns of a particular table but the default value of the columns is missing, How can I get it? ...

Siebel CSSBCActivity.SetGridBeginEndDate or how to get all instances of a repeating action in eScript?

Hi, I would like to get all instances of a repeating action via a eScript bcAction query. What I already found out about repeating actions: I create an repeating action, repeat interval = daily I can see multiple instances for this action in Siebel calendar applet. If I query all actions by eScript, I get a single row for the repeat...

SQLite Query : Select Query with BETWEEN clause

Hi all I want to run this query in Android Application : SELECT field1 FROM table1 where field1 = ?(enteredField1) AND field2 = ?(enteredField2) AND enteredField3 BETWEEN field3 , field4 ; my DB schema table1(field1, field2, field3, field4, field5) enteredField1 , 2 , 3 = are parameters which is to be checked. I hope I am clea...

How to execute a propel query?

Hi, how to execute a propel query? For example this: $c = new Criteria(); $c->add(AuthorPeer::NAME, $name); I know Doctrine method is execute() but using propel? Regards Javi ...

MS SQL Server 2005 GROUP BY and SUM

Hey all, i am trying to create a report to show how much is spent per HRCode. This is my SQL Query so far: SELECT * FROM tblWO as WO, tblWOD as WOD, tblWA as WA WHERE WOD.OrderID = WO.ID AND WA.HRCode = WO.AdministratorCode AND WO.OrderDate BETWEEN '2010-01-01' AND '2010-08-31' AND Approved = '1' ORDER B...

SQL Server 2005 SUM

Hey all, this is my query string here: SELECT SUM(Total) as Total, AdministratorCode, SUM(WOD.Quantity) as thePass FROM tblWO as WO, tblWOD as WOD WHERE WOD.OrderID = WO.ID AND WO.OrderDate BETWEEN '2010-01-01' AND '2010-08-31' AND Approved = '1' ORDER BY WO.AdministratorCode But i keep getting the error: The ...

Trouble returning a query from a Coldfusion method call

Ok, I have instantiated an object and all is fine. I am able to call various methods of that object easily, such as myobject.getId(), myObject.getName() , etc etc. These examples all return either a string or numeric value. Now I have another method that returns a query. I've cfdumped what is returned by the method and it is indeed a qu...

SPHINX search php query, how to display results from an array?

Im beginning to learn sphinx search php api after running this query <?php include('sphinxapi.php'); $cl = new SphinxClient(); $cl->SetServer( "192.168.0.100", 9312 ); $cl->SetMatchMode( SPH_MATCH_ANY ); $result = $cl->Query( "mimmi", "searchtest" ); if ( $result === false ) { echo "Query failed: " . $cl->Ge...

SQLite Query in Android Application giving error

Hey all one of my friend suggested me this (Tony), am I going wrong anywhere here ? because this is giving runtime error. application stopped unexpectedly. I may b wrong in syntax. just help me out, thanks in advance. I am gratefull for your response. public boolean checkData(String task1, String dte1, String startTime1) { SQLiteQuer...

C# XML Dynamic LINQ

Hi all, I am trying query an xml file with dinamyc linq query. I have followed the scottGu's Blog scottGu's Blog But I have a problem to make the where clause. This is the scenario. <Rates> <Rate id="1" tax="20.5" sex="M" name="Jhon"> <Rate id="2" tax="2.5" sex="F" name="Aline"> </Rate> The idea is to query the xml using a fil...

How to convert this HQL query with QueryOver?

Hello all, I have the following HQL query: return Session.CreateQuery("from Player p where p.Sex = :teamSex and p.Visible and not exists (from PlayerInTeam pit where pit.Player = p and pit.Roster.Team = :teamId)") .SetParameter("teamId", team.Id) .SetParameter("teamSex", team.Sex) .Enumerable<Player>(); How would you writ...

Nhibernate Criteria make dynamic query and get the row count

Hi, I am in big need of help. I am making dynamic query using Criteria: ICriteria query = session.CreateCriteria(typeof(Employee)); if (searchOptions.FirstName != null) { query.Add(Expression.Eq("FirstName", searchOptions.FirstName)); } if (!searchOptions.LastName != null) { query.Add(Expression.Eq("LastName", searchOptions.Last...

mysql query sum based on years

i friend i have a database table amount_id, year, amount, and data like this 1 2002 2 2 2002 3 3 2007 2 4 2004 6 5 2004 10 i wan to run a query to select data like this 2002 4 2007 2 2004 16 thanks for help ...

How to convert the SQLs of the symfony development bar to the MySQL SQLs ?

Hi, just that. Im using propel. REgards Javi ...

SQL. Query for aggregating certain dependent fields.

Sorry for the vague title, I didn't know how else to phrase this. Suppose you have a table such as the following table of stops on a train and the distances between this stop and the next: Stop NextStop Distance ------------------------------------ Middletown Bloomsbury 101 Bloomsbury Shanksville 36 Shanksville...

Simple SQL Query Help - Return Rows Where Criteria Matches ALL

How do I construct my query to return only the values that match a, b, AND c? For example, I would like to return all companies that have financial data with a fiscal year of 2007, 2008, and 2009. SELECT Company from Table WHERE FiscalYear IN (2007,2008,2009) gives me all the companies in which any of the 3 years exists. I need to fi...

doctrine2 dql query by property of serialized object within entity

I have an entity with an 'object' type column. I want to be able to retreive the entity by a property (say id) of that object. For example, the query would look something like this: $em->createQuery('SELECT e FROM Entity_Class e SOME_MAGIC e.object o WHERE o.id = ?1'); The question is, is there *SOME_MAGIC* in dql? ...

SQL Multiple Result question....

Can I use a single SQL statement to return three separate results I can display through PHP? I'm looking to formulate three different "total" counts on a single table with three different conditions. Eg something like.... $resultGetTotals = SELECT COUNT(Total1) FROM table_xyz WHERE Status = X AS Total1 SELECT COUNT(Total2) FROM table_x...

How can I run a query on IDs in a string?

I have a table A with this column: IDS(VARCHAR) 1|56|23 I need to run this query: select TEST from TEXTS where ID in ( select IDS from A where A.ID = xxx ) TEXTS.ID is an INTEGER. How can I split the string A.IDS into several ints for the join? Must work on MySQL and Oracle. SQL99 preferred. ...