query

Query MSQL for winners, starting at xth place using SELECT

In my MySQL table Winners, I have a list of people who have won. What I'd like to do is select a list of the names of 10 winners. So what I have right now is this: SELECT name FROM Winners ORDER BY points DESC LIMIT 10 This returns the first 10 winners which is great. But how can I make it (for example) return 10 winners, but starti...

mySQL query not returning correct results!

Hi! This query that I have is returning therapists whose 'therapistTable.activated' is equal to false as well as those set to true! so it's basically selecting all of the db, any advice would be appreciated! ` $query = "SELECT therapistTable.* FROM therapistTable ...

SQLiteQueryBuilder.buildQuery not using selectArgs?

Alright, I'm trying to query a sqlite database. I was trying to be good and use the query method of SQLiteDatabase and pass in the values in the selectArgs parameter to ensure everything got properly escaped, but it wouldn't work. I never got any rows returned (no errors, either). I started getting curious about the SQL that this genera...

MySQL slow queries

The MySQL slow query log often shows a bunch of following entries in sequence. SET timestamp=1268999330; commit; # User@Host: username[username] @ localhost [] # Query_time: 4.172700 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0 SET timestamp=1268999330; commit; # User@Host: username[username] @ localhost [] # Query_time: 3.628924...

Hibernate query: positioned parameter and named parameter

There are two types of query parameters binding in the Hibernate Query. One is positioned parameter and another one is named parameter. Can I use these two parameters in one Query? ...

Help with sql query

I have two tables: subject and student. I'm trying to count the number of subjects enrolled by each student. How do I do that?I'm trying the code below but it doesn't give the answer I need. Please help. SELECT COUNT( subject.SUBJECT ) , student.IDNO, student.FIRSTNAME, subject.SUBJECT FROM student, subject GROUP BY subject.SUBJECT LIMI...

A question about complex SQL statement

Table A has columns ID and AName, Table B has columns BName and ID. B.ID is foreign key of A.ID. Write a SQL statement to show data like: print column AName and C which describe whether Table B has ID in Table A, if exists 1 or else 0. So if A is: 1 aaa 2 bbb B is: something,2 output is: aaa,0 bbb,1 ...

how to optimize this query?

hi! The query is: select employee_id , last_name , salary , round((salary+(salary*0.15)), 0) as "NewSalary" , (round((salary+(salary*0.15)), 0) - salary) as “IncreaseAmount” from employees; Can I optimize this round((salary+(salary*0.15)), 0) part in anyway, so that it doesn't appear twice? I tried givi...

help with sql-server query - dates

Hi I have this table: id|date ---- 1 | 10/11/2009 2 | 13/11/2009 1 | 20/12/2009 3 | 21/12/2009 1 | 30/12/2009 If I stand on the last record (id=1) and I need to see the last date where id=1 is appear --> will show me: 1 | 20/12/2009 What query will do it ? Thanks in advance ...

SQL Where Clause Against View

I have a view (actually, it's a table valued function, but the observed behavior is the same in both) that inner joins and left outer joins several other tables. When I query this view with a where clause similar to SELECT * FROM [v_MyView] WHERE [Name] like '%Doe, John%' ... the query is very slow, but if I do the following... SELE...

Increase Query Speed in PostgreSQL

Hello, First time posting here, but an avid reader. I am experiancing slow query times on my database (all tested locally thus far) and not sure how to go about it. The database itself has 44 tables and some of them tables have over 1 Million records (mainly the movies, actresses and actors tables). The table is made via JMDB using the ...

MYSQL - Help with a more complicated Query

I have two tables: tbl_lists and tbl_houses Inside tbl_lists I have a field called HousesList - it contains the ID's for several houses in the following format: 1# 2# 4# 51# 3# I need to be able to select the mysql fields from tbl_houses WHERE ID = any of those ID's in the list. More specifically, I need to SELECT SUM(tbl_houses.Hous...

Dojo Grid Query

Hi, We are using ItemFileReadStore for providing data to Dojox DataGrid. We need to filter data based on the "status" column. The possible values of "status" are Delivered,Shipped,Processing. Can someone please let me know how to filter based on multiple status values. For example I need to filter by "Delivered" OR "Shipped". Currently ...

SQL server query not showing daily date result

I have a simple user production report where daily quotas are tracked. The sql returns a weeks worth of data for all users and for each day it tracks their totals. The problem is if they are out for a day and have a zero production for that day then the result query just skips that day and leaves it out. I want to return days even if the...

mySQL - How to select a date interval

Hello, this is my table : ------------------------------------- | user | item | date_time | | 10 | 01 | 10-10-10 20:10:05 | | 10 | 02 | 10-10-10 20:10:10 | | 10 | 03 | 10-10-10 20:10:10 | | 20 | 02 | 10-10-10 20:15:10 | | 20 | 02 | 10-10-10 20:20:10 | | 30 | 10 | 10-10-10 20:01:10 | | 30...

Transfer records from one MySQL DB to another.

How can I transfer specific rows from one MySQL DB on one server to another in a completely different server. Also the schemas don't necessarily have to be the same. For example on server "A" I could have a Users table with 2 columns and on Server "B" have a Users table with 4 columns. Thanks. ...

SQL simple query

I have the following table, Persons_Companies, that shows a relation between persons and companies knowns by these persons: PersonID | CompanyID 1 1 2 1 2 2 3 2 4 2 Imagining that company 1 = "Google" and company 2 is = "Microsoft", I would like to know the ...

A query for date within a year

My table is like this on Postgres, note that all days start by 01, there is only 1 entry a month+year SELECT * FROM "fis_historico_receita" +----+------------+---------------+ | id | data | receita_bruta | +----+------------+---------------+ | 1 | 2010-02-01 | 100000.0 | | 2 | 2010-01-01 | 100000.0 | | 3 | 2009-12-01...

linq to sql -> join

SQL query: SELECT ArticleCategories.Title AS Category, Articles.Title, Articles.[Content], Articles.Date FROM ArticleCategories INNER JOIN Articles ON ArticleCategories.CategoryID = Articles.CategoryID Object repository: public class ArticleDisplay { public int CategoryID; public str...

querying mysql and loading result into a list in a pythoncard gui

so heres whats up. I'm making a little program for myself that 1)takes a name of a row from a drop down box and makes a query with it and 2) displays query results into a multi-column list. i have the gui setup i need to sript the drop box with the query names and then have the results go into the list i set up in the gui heres the code...