query

Android contact query

Hey, I have a problem in querying phonebook contacts. What I need to do is get a list of contacts that have both phone and email entered or are of a specific type. Basically like this: public static final String SELECTION = "("+ContactsContract.Contacts.HAS_PHONE_NUMBER +"='1') OR " + RawContacts.ACCOUNT_TYPE + "='" + Constants.AC...

SELECT DISTINCT for multiple fields

In my table, I have Collection_Date and Tag_Date fields, both of type date. I need to query this table, separating each date into its component month, day, and year, but still keeping the distinction between the Collection_Date dates and the Tag_Date dates, and I don't want duplicates. I tried this: SELECT DISTINCT MONTH(Collectio...

SQL unique query -- need help

Hello, Need some help with what is probably a pretty basic SQL query. I'm trying to select the number of unique records that match a specific where clause. Essentially, I'm looking to find the number of unique users that logged in between date x and y. If a user logged in more than once between those dates, it would need to only count ...

Mysql Many to Many Query

I have a many to many table setup in my mysql database. Teams can be in many games and each game has 2 teams. There is a table in between them called teams_games. SHOW CREATE TABLE information follows. I have been messing with this query for a while. At this point I don't care if it requires sub-queries, joins, or unions. I have tried a...

Adding data from Excel to Mysql via VBA

UPDATED QUESTION...SEE BELOW I have an excel sheet which accesses a MySQL db as a backend.... I insert new records into MySql the following way, but I am not sure if this is the best way. For rowline = 1 To 50 strSQL = myquerystring (INSERT 5 columns per excel row) rs.Open strSQL, oConn, adOpenDynamic, adLock...

Python SQLite parameter substitution with wildcards in LIKE

I am attempting to use a parametrized LIKE query with Python's Sqlite library as below: self.cursor.execute("select string from stringtable where string like '%?%' and type = ?", (searchstr,type)) but the ? inside of the wildcard is not being evaluated leaving me with this error: "sqlite3.ProgrammingError: Incorrect number of bindings...

How do you query a LDAP from a web application for SSO?

Need to query an LDAP from a .NET app to create a single sign on scenario, is this feasible? ...

Access 2007 - Building unmatched data query, but need two field categories

Is it possible to build an unmatched data query using two tables with a tracking a unique value field and also another value in the row as well (that value will not be unique). For example I want to track a unique customer code from an invoice on a new table, compared to last month's invoice. The non unique value would be a "product co...

Query Google searches in Java?

Say I search for something on Google and I want to return the title and descriptions of the search given. Also I want to incorporate services like Google maps because sometimes when a product is searched on Google, the location of the store it is sold in is also displayed. How would I return that? ...

How do I solve an advance filter problem, using MySQL query

Hi, I would like to know a solution which can help me generate a MySQL query to fetch data as I want from a single data base table. Table name: Rates Columns: id, date, weekday, costA, costB, costC, sellA, sellB, sellC SAMPLE TABLE DATA ================= id | date | weekday | costA | costB | costC | sellA | sellB | sellC --------...

Hibernate disable Query Cache

Following problem: I create a Query to display all Entries of a MYSQL Table, if I edit a Field and execute the Query again I get the same (old) Result as in the first query. It seems that Hibernate caches the Result. I tried to disable Caching with query.setCachable(false) "hibernate.cache.use_second_level_cache" "cache....

Sql Union Query Help

Hi All, I need a little help writing a query. I have this data... vDir iNumber North 19 North 27 North 29 North 31 South 46 South 49 South 51 South 61 I need to query the data and have an output something like this vDir iLowNumber iHiNumber North 19 27 North 27 29 North 29 ...

Python: get escaped SQL string

When I have a cursor, I know I can safely execute a query as follows: cur.execute("SELECT * FROM foo WHERE foo.bar = %s", (important_variable,)) Is there any way to just get the string safely without executing the query? For example, if important_variable is a string, like "foo 'bar' \"baz", I'd want the appropriately escaped one: "S...

mysql slow query log

I am trying to write a script to parse the MySQL slow query log. I have seen 1 or 2 parser. does anyone know how to extract the information from that log? I mean does anyone know the structure of the file so I can work with that and if anyone know a good parser for this log file? thanks ...

JPA EntityManager createQuery() with IN not working

About to kill myself here. This is failing: List<String> names = new ArrayList<String>(); names.add("sold"); Query query = em.createQuery("FROM PropField propField WHERE propField.name IN (?)"); query.setParameter(1, names); List<PropField> fields = query.getResultList(); And so is this: List<String> names = new ArrayList<String>();...

Select statement not working in Sqlite

i have a table with 19 columns. if i query using select * from tab where id=1; i'm able to obtain all the attribute values. whereas, if i query using select name from tab where id=1; i get no output. (name is defined as of type text in the schema) i don understand what the hell is going wrong.. ...

Language to constrain large datasets for ruby/java and javascript

I got a backend web service containing massive amounts of data that I have control over and I need to fetch data from it through a browser frontend. The frontends task is to simply display the data in a paged table but the user should be able to dynamically constrain the data based on the fields and i can't load the entire matching data ...

Complicated SQL query

I'm trying to build a specific sql query but i have no idea how to implement what i want. My database looks like this: Col1 Col2 "a" 5 "b" 7 "a" 8 "a" 7 "b" 5 "b" 7 "c" 3 "a" 4 "b" 3 "b" 4 "c" 1 And I want a query that returns something like this: "a" 8 "a" 7 "b" 7 "b" 7 ...

SQL query join question

How do you do SQL query for the following condition? Suppose you have two tables: table1 and table2, where each entry in table1 can have multiple corresponding entries in table2. The pseudo code for the query that I want is: for each $row in table1 $rows = find all rows in table2 that corresponds to $row with $row.id == table2.foreig...

How can I do this in SQL? I need to find possible permutations of a small table of data

Hi All, I have this small table of data. Dir LinkL LinkH East 19 27 East 27 29 East 29 31 West 46 49 West 49 51 West 51 61 These represent possible trips. How can I query this? For instance if you started at station 19, you could go from 19->27, 19->29, and 19->31. Three possible "trips" But starting from 2...