query

For a set of sql-queries, how do you determine which result-set contains a certain row?

I have a set of sql - queries: List<String> queries = ... queries[0] = "select id from person where ..."; ... queries[8756] = "select id from person where ..."; Each query selects rows from the same table 'person'. The only difference is the where-clause. Table 'person' looks like this: id | name | ... many other columns How can...

error in arabic script in mysql

i inserted data in mysql database which includes arabic script. while the output displays arabic correctly, the data in mysql looks like garbage. something like this: '&#1589;&#1614;&#1608;&#1605;&#1615; &#1579;&#1614;&#1604;&#1575;&#1579;&#1614;&#1577;&#1616; &#1571;&#1610;&#1617;&#1575;&#1605;&#1613; &#1605;&#1616;&#1606; &#1603;&#16...

Finding values from a table that are *not* in a grouping of another table and what group that value is missing from?

I hope I am not missing something very simple here. I have done a Google search(es) and searched through stackoverflow. Here is the situation: For simplicity's sake let's say I have a table called "PeoplesDocs", in a SQL Server 2008 DB, that holds a bunch of people and all the documents that they own. So one person can have several ...

Search & Replace SQL

I am messing around with one of my databases.. is there away for me to search for a string in ALL the tables.. and replace it with another everywhere it occurs? I am looking for SQL ...

SQL query using information from 4 tables (not all directly linked)

I'm developing a simple classroom system, where teachers manage classes and their subjects. I have 2 levels of access in my teachers table, assigned by an integer (1 = admin, 2 = user)... Meaning that the headteacher is the admin :) A teacher (of level 1) can have have many classes and a class can have many teachers (so I have 'Teacher...

Need help with this SQL

Hi guys, I am very very new to mysql. I am trying to execute the following query. update share set holder = 22 where SHARE_ID IN (select SHARE_ID from SHARE WHERE holder=1 LIMIT 10) When I try to execute the above query I am getting this error #1235 - This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' ...

Problem with write query

Hi, I've got collection of geo objects in database: There are four Tables: Countries Regions Provinces Cities Cities has inter alia ProvinceCode Provinces has inter alia regionCode Regions has inter alia CountryCode And there is fifth Table: Descriptions ObjectCode ObjectType(country, region, province, city) Description. How to ...

sql: trying to select the second biggest element but selects the biggest

we want to have the second biggest element. We first use ANY to exclude the biggest one. Then we use all to select the biggest. However when we run this query, it shows the biggest and not the second one. Why? SELECT * FROM bestelling WHERE totaalprijs > ALL ( SELECT totaalprijs FROM bestelling WHERE totaalprijs < ANY (...

mysql select query problem

i have a form that has a multiple select drop down. a user can select more than one options in the select. the name of the select is array[]; using php I call implode(",",$array) in mysql db, it stores the field as a text in this format "places"= "new york, toronto, london" when i want to display these fields i explode the commas. I am ...

Delete, Truncate or Drop MySQL question

Hi Everyone! I am attempting to clean out a table but not get rid of the actual structure of the table, i have the following columns: id, username, date, text the id is auto incrementing, I don't need to keep the ID number, but i do need it to keep its auto-incrementing characteristic. I've found delete and truncate but I'm worried one...

Adding up row number and displaying total using COUNT (PHP MySQL)

I'm attempting to run a query that adds up the total number of subjects in a class. A class has many subjects. There is a 'teachersclasses' table between teachers (the user table) and classes. The principles sounds pretty simple but I'm having some trouble in getting my page to display the number of subjects for each class (directly asso...

Is there a library / tool to query MySQL data files (MyISAM / InnoDB) without the server? (the SQLite way)

Oftentimes I want to query my MySQL data directly without a server running or without having access to the server (but having read / write rights to the files). Is there a tool or maybe even a library around to query MySQL data files like it is possible with SQLite? I'm specifically looking for InnoDB and MyISAM support. Performance is ...

What is the easiest way to find a sql query returns a result or not?

Consider the following sql server query , DECLARE @Table TABLE( Wages FLOAT ) INSERT INTO @Table SELECT 20000 INSERT INTO @Table SELECT 15000 INSERT INTO @Table SELECT 10000 INSERT INTO @Table SELECT 45000 INSERT INTO @Table SELECT 50000 SELECT * FROM ( SELECT *, ROW_NUMBER() OVER(ORDER ...

Specifying a variable name in QUERY WHERE clause in JDBC

Could someone please give me a link on how to create a query in JDBC that gets a variable name in the WHERE statement, or write an example, to be more specific, my code looks something like this: private String getLastModified(String url) { String lastModified = null; ResultSet resultSet; String query = "select LastModif...

Unable to Get a Correct Time when I am Calling serverTime using jquery.countdown.js + Asp.net ?

<script type="text/javascript" src="Scripts/jquery-1.3.2.js"></script> <script type="text/javascript" src="Scripts/jquery.countdown.js"></script> <script type="text/javascript"> $(function() { var shortly = new Date('April 9, 2010 22:38:10'); var newTime = new Date('April 9, 2010 22:38:10'); //for lo...

mysql database normalization question

here is my 3 tables: table 1 -- stores user information and it has unique data table 2 -- stores place category such as, toronto, ny, london, etc hence this is is also unique table 3 -- has duplicate information. it stores all the places a user have been. the 3 tables are linked or joined by these ids: table 1 has an "table1_id" ta...

Stop mysql query if it too long

How do I automatically interrupting long queries in the mysql, if it possible? I'm understand, that I need optimize queries instead of. But now I have access on database server only. ...

mysql query - syntax error - cannot find out why

Hi all, im tearing my hair out over this one. A query is throwing an error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM, SUBJECT, DATE, READ, MAIL ) VALUES ( 'EJackson', 'dfdf', '1270974101', 'fa' at line 1 I printed out the query to see...

Help with SQL query (Calculate a ratio between two entitiess)

Hi, I’m going to calculate a ratio between two entities but are having some trouble with the query. The principal is the same to, say a forum, where you say: A user gets points for every new thread. Then, calculate the ratio of points for the number of threads. Example: User A has 300 points. User A has started 6 thread. The point rat...

JPA query many to one association

I want to build the following pseudo query Select a From APDU a where a.group.id= :id group is a field in APDU class of the type APDUGroup.class. I just want to get a list of APDUs based on APDUGroup's id. How do i do that using a standard JPA query? UPDATE Yes, I have tried the above query and tried other variations for hours befo...