query

PHP & MySQL Problem

I Have a script, getting text from DB and post it on other DB. Problem is, if I have a Text lngen then 840 Words, I can't call this page. Get an error about "Not Found" or "Connection brocken" or what ever. In FF i get no error, only blank page. I found out the Problem is in lenght of the query i send... but how can i fix it??? My it...

sql statement question. Need to query 3 tables in one go!

Hey there, I have an sql database. In this database is 3 tables I need to query. The first table has all the item info called item and the other two tables has data for votes and comments called userComment and the third for votes called userItem I currently have a function which uses this sql query to get the latest more popular (in te...

Help combining these two queries

I need a SQL query that returns results matched by EITHER of the following SQL queries: Query 1: SELECT "annotations".* FROM "annotations" INNER JOIN "votes" ON "votes".voteable_id = "annotations".id AND "votes".voteable_type = 'Annotation' WHERE (votes.vote = 't' AND votes.voter_id = 78) Query 2: SELECT "annotations".* FROM "annota...

Adjusting sql statement in a function based upon input

Hey there, This is a bit urgent! I'm trying to make a simple filter search where-by you can choose from a series of 3 drop downs and then based upon this the results are then displayed, How would I go about adjusting the sql query for each and if you were to only choose to search from aone of the 3 rather than all 3 etc... example ther...

Search a DAG with boolean constraints on reachability

The queries are something like Return all vertices such that (reachable from (A and (B or C))) and (not reachable from (D and E)). The query can be formed with any kind of boolean constraints on reachability. Are there efficient methods to do this query fast? Other than actually find the set of all item reachable vertex of concern, t...

group by with 3 diffrent

I have 2 table and I wanna a query with 3 column result in on of them 2 column with view count and title name and in the other 1 column with type_ and i wanna to grouping type_ with max(view count) and show the them title but i didn't have any idea about grouping expression. i think we can solve in by using sub query but i don't kno...

mysql query for this problem

hi i have a table as follows id,school,address,city,state,phone,email,fax . There is almost 40 cities . I need to select 1 entry from each city. can any one guide me example city a1 30 entries a2 12 entries ...... a40 36 entries Pick 1 from each a1,a40 ...

How passa parameter to IN Operator in NHibernate?

HI, I'm Trying, pass a long array for a named query (native sql) for to use in a IN STATEMENT: Like this: (...) WHERE Identificator IN (:pIdes) I tried pass my ides as long[]: ctx.GetNamedQuery("NamedQueryName") .SetParameter<long[]>("pIdes", Identificators) ...

Deleting certain rows based on the count of a column in the mysql database

Hi, I have a very large database with about 120 Million records in one table.I have clean up the data in this table first before I divide it into several tables(possibly normalizing it). The columns of this table is as follows: "id(Primary Key), userId, Url, Tag " . This is basically a subset of the dataset from delicious website. As I s...

SQL wont work? It doesn't come up with errors either

Hey there, I have php function which checks to see if variables are set and then adds them onto my sql query. However I am don't seem to be getting any results back!? $where_array = array(); if (array_key_exists("location", $_GET)) { $location = addslashes($_GET['location']); $where_array[] = "`mainID` = '".$location....

Help with MySQL query... Need help ordering a group of rows

I can tell it best by explaining the query I have, and what I need. I need to be able to get a group of items from the database, grouped by category, manufacturer, and year made. The groupings need to be sorted based on total amount of items within the group. This part is done with the query below. Secondly, I need to be able to show ...

SELECT USING COUNT in mysql

Hi, I have a very large database with about 120 Million records in one table.I have clean up the data in this table first before I divide it into several tables(possibly normalizing it). The columns of this table is as follows: "id(Primary Key), userId, Url, Tag " . This is basically a subset of the dataset from delicious website. As I s...

Slow MySQL Query not using filesort

I have a query on my homepage that is getting slower and slower as my database table grows larger. tablename = tweets_cache rows = 572,327 this is the query I'm currently using that is slow, over 5 seconds. SELECT * FROM tweets_cache t WHERE t.province='' AND t.mp='0' ORDER BY t.published DESC LIMIT 50; If I take out either the WHER...

how to order a group result with Linq?

How can I order the results from "group ... by... into..." statement in linq? For instance: var queryResult = from records in container.tableWhatever where records.Time >= DateTime.Today group records by tableWhatever.tableHeader.UserId into userRecords select new { UserID = userRec...

how to design the query for non-sql database

can anyone give some reference for non-sql database query interface design pattern? For sql-based database, the query can be achieved by combining the query token. but for non-sql, how to design the query, given that the query could be very complex. EDIT: I am using db4o to store some objects, I may need to query according to a certai...

c# - pull records from database without timeout

Hi folks, i have a sql query with multiple joins & it pulls data from a database for processing. This is supposed to be running on some scheduled basis. So day 1, it might pull 500, day 2 say 400. Now, if the service is stopped for some reason & the data not processed, then on day3 there could be as much as 1000 records to process. This...

Google App-Engine Java Group By and Count(*) queries

I am able to insert, filter and order records but can't use a simple count!! I am wondering if there a way to get no of total rows in a table?? Is there a way to use GROUP BY in query? ...

WordPress SQL Query on Category/Terms

Hi, i am modifying a plugin slightly to meet my needs, and need to change this query to return post ID's of just one category. I know it has something to do with INNER JOIN, but cant get the query right. Here is the original query $query = "SELECT ID as PID FROM $wpdb->posts"; $results = $wpdb->get_results($querydetails,ARRAY_A); ED...

Solr OR query for different combination of facets

I have a sample Solr schema as follows isPublic = boolean source = facebook| twitter | wordpress I want to write a query which returns all documents from the index which matches either the isPublic = true or isPublic is false and source= facebook. Something like this solrUrl/?q=blah&fq=(isPublic:true OR (isPublic:false AND sourc...

how to query with child relations to same table and order this correctly

Hi, Take this table: id name sub_id --------------------------- 1 A (null) 2 B (null) 3 A2 1 4 A3 1 The sub_id column is a relation to his own table, to column ID. subid --- 0:1 --- id Now I have the problem to make a correctly SELECT query to show that the child ro...