query

ADO.NET: query a DataTable on a timeout

Hello, I have an in-memory DataTable that contains two fields of type DateTime, respectively LastAction and LastHeartbeat meaning the last time an entity sent an activity log message and the last time the entity sent a heartbeat ("I'm alive") log message. I'm building a method to query the data table with various criteria, including the...

A question on editing a seach view in Django

Hello I am working in django how to use a search form from Django documents site. Here are some information below. Now, is there a way I can produce a part search for title? For example if I wanted to search for a book called "Apress", But instead of typing the whole word I just wrote "ap" to get Apress. Is there a way how to achieve thi...

Freebase: Format search result to list all properties of object of unknown type(s)

I'm trying to write a MQL query to format a search result in freebase (the "output" parameter in the search API). I essentially want to find the (simple) values of all the properties of a given search result (without knowing anything about the types of the result a priori). By "simple", I mean only the default properties if the values ar...

Trouble with MS Access 2007 SQL Query

Are ordinary sql queries different from MS Access 2007 queries? I have this simple query but it is not working in MS Access query (SQL View). What is wrong with this? SELECT StudentSubject.*, Subject.*,Professor.*, Student.*, Church.* FROM ( SELECT StudentSubject.*, Subject.*,Professor.* , Student.* FROM ( SELECT StudentSubject....

How to select UNIX date = "2010" in mysql query?

Here is my code so far: SELECT `date`, title, category, url FROM cute_news WHERE category = '4' ORDER BY `date` DESC I want make pages based on the year, like, 2010 , 2009, 2008 and so on. The database saves the date as UNIX_Timestamp. Not sure how to query a recordset with a Year parameter? WHERE unix_timestamp(YEAR) = '2010' or som...

What's wrong with this SQL SELECT?

Hi, I'm using SQL Server and querying it with php. I have a query that selects data based on dates entered. $tsql = "SELECT COUNT(tblBackupArchive.StatusID) AS total, tblBackupArchive.StatusID ". "FROM tblBackupArchive INNER JOIN ". "tblBackup ON tblBackupArchive.BackupID = tblBackup.BackupID ". "W...

xpath not working as expected

From comments I found the issue :(, Thank you so much for your help, its appreciated, the reason's was because error reporting was switched off and then there was a missing function, causing the script to stop executing in its place For some reason this Xpath query is not working as expected foreach($this->Xpath->query...

I get dual results from mysql query when using international charachters, i.e Å/Ä=A & Ö=O,

For example if I search for the name Åsa i only want to get the name Åsa and not Asa, same with Björn instead of Bjorn $query="select * from users where username like 'Björn'"; $result=mysql_query($query); $num=mysql_num_rows($result); echo"$num"; $i=0; while($i<$num){ $id=mysql_result($result,$i,"id"); $name=mysql_result($result,$...

search in a table

Hi! I have this website to search for books, there is only ONE text field, to search by words, title author, whatever it types. if the name of the book is hello goodbye, and the author is A. Jones if i type hello i get the result of the book (my query is using the like statement) i check if title like %string_introduced% or author ...

Query field across multiple django models

I want to create a "What's New" section that lists all of the database changes in the last day. I've added an "updated" field to my models: class Film(models.Model): . . . updated = models.DateTimeField(auto_now=True) class Actor(models.Model): . . . updated = models.DateTimeField(auto_now=True) Now I want to...

How can I optimize this confusingly slow query in MySQL?

I have a table of blog posts, each with a foreign key back to it's author. There are < 15,000 entries in this table. This query scans over 19,000 rows (per EXPLAIN), requires a filesort (that might be regular MySQL behavior), and takes over 400ms to return 5 rows. possibly because of the complicated WHERE used to check if the item is act...

Query embedded object with AND in mongodb

Let's say there is: {username : "tom1", address : { type : 0, year : 2001 }} {username : "tom2", address : { type : 1, year : 2011 }} {username : "tom3", address : { type : 0, year : 2031 }} {username : "tom4", address : { type : 1, year : 2002 }} I'm using Java Driver, how can I query: users who's address.type = 1 AND address.year > ...

How to make criteria with complex query in Yii framework?

I have query like this: SELECT * FROM activity WHERE (((userId = 1 OR userId IN(SELECT userId FROM follower WHERE followerId = 1)) AND activityType IN(1, 2, 3)) OR (targetId = 24 AND aType IN(1, 2, 3, 4, 5))) ORDER BY id DESC; I have try to use model()->findAllBySql($sql) and it works. But I want to make it using CDbCriteria, if you h...

Information regarding query profiler.

hi all, Does anyone have an information about a good query profiler?? By query i mean about 5 page search query.The profiler should be such as which gives the bottleneck in the query. thanks ...

PostgreSql + Query Statement having \r in between the attributes !!!

Suppose we have a textarea in which we put example string. Textbox contain : Earth is revolving around the Sun. But at the time of saving, I just pressed a enter key after "the sun". Now the statements in texbox :: Earth is revolving around the Sun Now, in database where enter was pressed the \r is stored. Now i am trying to fetch...

A Django seach form that I cannot make it work

Hello I have been recently working on Django search forms recently and have tired to edit one myself. Here is a search form that is supposed to find Clients. However When I type in a clients name, it does not display that client's name. So I am wondering What I am doing wrong. #model.py class Client(models.Model): comp...

I need help with complex join

There is one-2-many relation between Property and Reservation. Property has column called 'nr_of_bookings'. I need DQL that will retrieve only the properties that has COUNT(Reservation) less than Property.nr_of_bookins. An example: Some Property has nr_of_bookings = 3 . If it has 5 Reservations related, it will not be retrieved. But if ...

SQL and PHP database access

I'm very new to PHP, SQL I've worked with using Coldfusion but only with very simple queries. In coldfusion to access a specific database <cfquery dbname="blah"> I know in PHP I have to use mysql_query() and mysql_connect(), and here is the code I have, so I understand how to access a server and a table, but not the database. How can ...

how to increase mysql full-text accuracy?

I am running a simple mysql full-text query that searches for users on my site based off of their "display name". The query example is below - in this example we are searching 'lancaster toy store': SELECT MATCH(`display_name`) AGAINST ('lancaster toy store') as `rel` WHERE MATCH(`display_name`) AGAINST ('lancaster toy store') ORDER BY ...

querying a sqlite db with date needs always a time value too like ("yyyy-MM-dd 00:00:00");

Hello, I use C# and sqlite. To get data for a certain datetime value I have to write this: com.Parameters.Add(new SQLiteParameter("@MyDate", day.ToString("yyyy-MM-dd 00:00:00"))); In my database all date entries have a time date + 00:00:00. How can I query my database with ONLY a date format not datetime format? ...