query

PHP: How to use mysql fulltext search and handle fulltext search result

Hello, I have tried to use mysql fulltext search in my intranet. I wanted to use it to search in multiple tables, and get the independant results depending on tables in the result page. This is what i did for searching. $query = " SELECT * FROM testtable t1, testtable2 t2, testtable3 t3 WHERE match(t1.firstNa...

Meaning of parameters in a Google query?

Are there any ressources on what the parameters in a Google query mean? Any analysis how the Google search pages work internally? Examples would be http://www.google.com/#hl=en&source=hp&q=lol&aq=f&aqi=&aql=&oq=&fp=45675624562456 or http://www.google.com/url?sa=t&source=web&ct=res&cd=11&v...

LINQ to XML query returning a list of all child elements

I have got an XML document which looks something like this. <Root> <Info>....</Info> <Info>....</Info> <response>....</response> <warning>....</warning> <Info>....</Info> </Root> How can i write a LINQ to XML query so that it returns me an IEnumerable containing each child element, in this case all five child elements of , so that i c...

Get percentiles of data-set with group by month

Hello, I have a SQL table with a whole load of records that look like this: | Date | Score | + -----------+-------+ | 01/01/2010 | 4 | | 02/01/2010 | 6 | | 03/01/2010 | 10 | ... | 16/03/2010 | 2 | I'm plotting this on a chart, so I get a nice line across the graph indicating score-over-time. Lovely. Now, what...

Semi-complex aggregate select statement confusion

Alright, this problem is a little complicated, so bear with me. I have a table full of data. One of the table columns is an EntryDate. There can be multiple entries per day. However, I want to select all rows that are the latest entry on their respective days, and I want to select all the columns of said table. One of the columns is a...

LINQ query null reference exception

Hi! I have the next query: var bPermisos = from b in ruc.Permisos where b.IdUsuario == cu.Id select new Permisos(){ Id=b.Id, IdUsuario=b.Id, IdPerfil=b.Id, Estatus=b.Es...

How do I programatically format layers produced by a query loop?

This problem is similar to when creating alternate colour table-rows, only we are dealing with divs and margins instead of table rows and their colours. The following code creates as many layers as there are genres returned from a query (if three genres are found, three layers are created); and within each layer created, the code create...

index help for a MySQL query using greater-than operator and ORDER BY

I have a table with at least a couple million rows and a schema of all integers that looks roughly like this: start stop first_user_id second_user_id The rows get pulled using the following queries: SELECT * FROM tbl_name WHERE stop >= M AND first_user_id=N AND second_user_id=N ORDER BY start ASC SELECT * FROM tbl_...

MDX Filtering at fact level

Hi folks, im pretty newbie at mdx sintaxys. I have the next requirement that i need to be able to solve it using mdx, if its possible. I need to show the number of SALE transactions which amout value is greater than "X" , the number of SALE transactions which amount value is less than "Y" , the number of CREDIT transactions which amout...

Global find object references in NHibernate

Is it possible to perform a global reversed-find on NHibernate-managed objects? Specifically, I have a persistent class called "Io". There are a huge number of fields across multiple tables which can potentially contain an object of that type. Is there a way (given a specific instance of an Io object), to retrieve a list of objects (o...

Subquery and selecting oldest rows for multiple foreign keys in MySQL

I have two tables: product (idproduct, name, description, tax) product_storage (idstorage, idproduct, added, quantity, price) for each product it could be different price and oldest are "first-to-sell" for example in storage I have: 1, 1, 2010-01-01, 0, 10.0 2, 1, 2010-01-02, 0, 11.0 3, 1, 2010-01-03, 10, 12.0 4, 2, 2010-01-04, ...

DISTINCT a column in a database

Hi, I'm trying to perform a DISTINCT clause on a query like this SELECT DISTINCT username, wiki.text, wiki.date FROM wiki_house INNER JOIN wiki ON wiki_house.wiki_id = wiki.id INNER JOIN users ON wiki.user_id = users.id AND wiki_house.house_id = 1 AND wiki.language = 'it' ORDER BY wiki.date DESC LIMIT 10 this returns: username wi...

How can SOLR be made to boost within result set?

I have indexed some documents that have title, content and keyword (multi-value). I want to search on title and content, and then, within these results boost by keyword. I have set up my qf as such: <str name="qf"> content^0.5 title^1.0 </str> And my bq as such: <str name="bq">keyword:(*.*)^1.0</str> But I'm fairly sure t...

How to construct NHibernate criteria to find parents who has all specified children

A Project can have many Parts. A property on Part is Ipn, which is a string of digits. Project "A" has Parts "1", "2", "3" Project "B" has Parts "2", "3", "4" Project "C" has Parts "2" Project "D" has Parts "3" I want to find all Projects that have all of the specified parts associated with it. My current query is var ...

what is the difference between WHERE and HAVING

Possible Duplicate: SQL: Whats the difference between HAVING and WHERE? i am learning sql syntax and i can't understand this. the second half of the question is a much more technical one. what is actually happening behind the scenes of the database between WHERE and HAVING? which one uses more resources? are they same algori...

nHibernate collections and alias criteria

I have a simple test object model in which there are schools schools have a collection of students. I would like to retrive a school and all its students who are above a certain age. I carry out the following query in the following manner : public School GetSchoolAndStudentsWithDOBAbove(int schoolid, DateTime dob) { va...

Core data query on a NSSet of NSSet

Hi everyone, I'm struggling with core data... I don't understand some things so if someone could help me, I would be very grateful! I have an entity (Recipe) with a relationship to-many with another one (Meal). I would like to select all the recipes which have no connection with a meal... so I've tried: Code: [myRecipes filteredSetUsin...

Mysqli query results: Best approach, do you close, free, both?

Hello all, I have some questions about using mysqli, queries, and related memory management. The code here is just to clarify my questions, so don't dump on it for error checking, etc. I know that needs to be done :) Suppose I have something like this: @ $db = new mysqli($dbhost, $un, $ps, $dbname); $query = "SELECT field1, field2 ". ...

Collapsing overlapping rows from multiple joined tables into as few rows as possible

Table_Design: ID "Alpha" "Beta" Table_Size: Design_ID Size "Alpha" S "Alpha" M "Alpha" L "Beta" S "Beta" L Table_Color: Design_Id Color "Alpha" "Black" "Alpha" "Blue" "Alpha" "Red" "Alpha" "Green" "Beta" "Orange" select D.ID, S.Size, C.Color from Table_Design D Left Outer Join Table_...

where clause from where clause

i need to do this : There is a table called table1 it has a employee id column,status column which has values 1 and 0 only and a department column with values 100,101,102. i want to list all employeeid with the status = 0 and (department=100 whose status=1) Please help me ...