query

Can Solr return the actual final query that was used when synonyms and stemming are used?

Hello, I would like to be able to show in my UI what the query terms were that solr used to run the final query. For example, I might type the query "run" but behind the scenes solr will use stemming to also query "ran" and "running", I may also have a synonym defined which has "run = sprint". I would like to show the user that although...

PHP MySql query 2 tables that have no common attributes at the same time???

Hello All, I am trying to query 2 tables in a database, each query having nothing to do with each other, other then being on the same page. Query 1 - The first query on the page will retrieve text and images that are found throughout the page from Table A. Query 2 - The second query will retrieve several products with a image, descrip...

Is there anyway to implement Full Text Search (FTS) in SQlite from Android platform?

I am trying to create an application which collects a lot of notes from users. I want to implement full text search on the notes so that the user can get relevant notes from the whole array of notes. I am looking for a solution for this. Full-text-search(FTS) is actually supported by SQLite, but is it available for Android? Can anybody ...

Query parser and optimizer for OSGi/LDAP filters/queries?

I'm looking for a query parser and optimizer that can work with OSGi filter conditions, which are based on LDAP query syntax. Preferably something implemented in Java, but a different implementation (even web based) would be good too. My main use case is to feed it queries that maybe can be simplified. ...

10,000 foot overview question on SQL Server query composition

I've just migrated from Access where I would "write" SQL constantly and quickly using their GUI layout. I'm very new to SQL Server and am puzzled why is there no query GUI in SQL Server. Is it just that much more powerful that a GUI wouldn't be able to address the majority of queries? Or is it like a purist thing where once one is no ...

How to write better this Mysql Join query

I have the next tables Users {id, name} Messages {id, user_id, cache_user_name} What I want is to do a JOIN only when cache_user_name is NULL for performance reasons. For example: SELECT Messages.*, Users.name FROM Messages INNER JOIN Users ON (Messages.user_id = Users.id) // ON (ISNULL(Messages.cache_user_name) AND ... The best...

Query objects with an array (without 3rd party script)

How can you query an object with an array? var myArray = ['A','C'] Using myArray, how can I get a returned array with ['1','3'] out of the following (previously JSON object) (without using a third party query script -- unless it's jQuery :) [ { "property1": "1", "property2": "A" }, { "property1": "2", "property2": "B...

Query to Database MySQL

I need Yoour help: I want search from table how many users(id_uzy) makes reservation on example this week, next which hours they reserved (godzina[pl] -> hour[en]) and for this hours find all id_urz. Example: id_uzy->1->hour(9-10)-->id_urz(2,3,4) id_uzy->1->hour(10-11)-->id_urz(2,3,4) id_uzy->2->hour(10-11)-->id_urz(4,5) id_uzy->1->h...

How can I use imply an OR query on an B-Tree?

I want to use b-tree for index, but I can't think out an solution for OR query. For OR query, I mean something like select * from table where id between 1 and 5 OR id between 10 and 15; if I use id as the key in the b-tree, than how can I do query like above on the b-tree? when search through the b-tree, assume that the key that are s...

mysql inner join statement and memory overuse !

hey guys im running bellow query to fetch from 3 mysql tables and it works fine but it increases memory usage and sometime it takes 10 seconds to start loading the page INNER JOIN table_tags AS ntg ON (ns.tags = '' OR CONCAT(' ',COALESCE(ns.tags,' '),' ') LIKE CONCAT('% ',ntg.tid,' %')) INNER JOIN table_topics AS nto ON (ns.asso...

What's Wrong with this HQL Query?

With this HQL query: SELECT DISTINCT fs FROM FileStatus fs WHERE UPPER(STR(fs.filePath)) LIKE :FILE_PATH I get: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:637) ...

SQL Query for adding missing values for a field between two dates?

Ok, So I have these two tables - BioUser- UserId,Weight,DateAdded DimDate-Date // It has basically all the dates for any period..its basically a table with all dates till 2050 Now the BioUser table has entries for weight of a user but not for everyday but whenever they enter their weight. So I want to basically build a list of values...

Sql Server Xml Column Best Practices

Hi All, What are the best practices for working with Sql server Xml columns to ensure quick performance and also ease of reporting? How do you set up the column? do you leave it as untyped? or associate it with a schema? Does associating the xml column with a schema improve query performance? Our use of xml columns is as follows: ...

if no row return then it's false when using php with mysql

I noticed that a lot of tutorial instructions often have this code: $sql="SELECT * from table"; $num=mysql_num_rows(); if ($num > 0) { do something } Why do they have to use that condition "if ($num > 0)" when I write this code that I think is compact and readable: $sql="SELECT * from table"; $itExists=mysql_num_rows(); if ($itExis...

Subsonic.DataService Missing in Subsonic 3.0.0.4?

How do I execute QueryCommand Object in SubSonic 3.0.0.4 without DataService? ...

Querying XML file?

I have a relatively small xml file <g> <page no="1" href="page1.xml" > <pic src="20100101001.jpg">1</pic> <pic src="20100101002.jpg">2</pic> <pic src="20100101003.jpg">3</pic> </page> <page no="2" href="page2.xml" > <pic src="20100101011.jpg">1</pic> <pic src="20100101012.jp...

Select Difference Between Rows (Postgres)

i'm aggregating facebook "like" counts for urls over time. each hour, i check the "like" count and insert it into a timestamped row. how can i get the difference in total between the new row and the previous hour's row? eg, insert total=5 for id=1 at 2pm insert total=12, diff_since_last=7 for id=1 at 3pm thanks! ...

Tips on writing SQL for multiple databases

Different databases have differences in SQL support & implementation. Sometimes there is a difference in SQL syntax, sometimes support for some SQL commands is missing, sometimes the database has a feature that other databases do not have. What are considered to be good practices in writing SQL queries that are good for different databa...

Optimize this query, retrieve users from a MySQL db with 500.000 users and one conditional

Suposse I have the next MySQL database with 500.000 rows: users { id - int, name - varchar(32), verified - tinyint(1) } primary { id } index { verified } And I need to get last 20 not verified users, so I use the next query: SELECT * FROM users WHERE verified != 1 ORDER BY id DESC LIMIT 20 But it takes 1...

How to run a SQL Query from Excel in VBA on changing a Dropdown.

I'm trying to create a dropdown that upon changing the selection from the list of options will run a query that will insert the query results into the page. Here's what I have thus far: Sub DropDown1_Change() Dim dbConnect As String Dim leagueCode As String Dim leagueList As Range Dim leagueVal As String Dim TeamDat...