query

how to use python to run a google search and print out the results

Hi I wonder if you can help. I want to write a script in python that will run a query on google and output the results of the query as Thanks adaptive ...

MySQL query help: how to pivot this table?

Given a table like this: ============================================== | ID1 | ID2 | ID3 | Name | Value | ============================================== | 16 | 1 | 100 | item_name | Toys | | 16 | 2 | 101 | item_name | Computer | | 16 | 1 | 102 | item_price | 55 | | 16 | 2 | 103 | item_price ...

Conditional Columns - MySQL query

I need to display a particular column in my SQL result only if it is not null. If it is null, I don't want that column to appear at all in my result. Is there a way to express this condition in SQL? ...

Getting Root & Leaf Nodes for a Given Id - How to?

Assume I have a table that has the following structure: ================= | Id | ParentId | ================= | 1 | 0 | | 2 | 1 | | 3 | 1 | | 4 | 2 | | 5 | 2 | | 6 | 3 | | 7 | 3 | ----------------- This results in a tree like this: 1 / \ 2 3 / \ / \ 4 5 6 7...

Nested Callback Handlers?

I am getting a set of data from the database where the query produces a repetition of data with a different "Special" value. For example the user "A" can be repeated twice, having three different "Special" values under the "Special Column". I am using a callback handler to retrieve the data and put it into a list, now additionally I wan...

what is a range query

What is a range query over a kdtree and how is it done by python? ...

Combine multiple SQL fields into 1 output row

Having a SQL table like UserID |Attribute | Value 1 |Username | Marius 1 |Password | Fubar I want to create an output like: 1 | Marius | Fubar Maybe I'm just too tired to see it, doesn't sound too complicated, but I just can't seem to figure it out. Any help is appreciated. ...

unexpected sublist result returned by Hibernate query

Hi, I hava a HQL query as the following which returns a java.util.RandomAccessSubList of ORDER. The offset of the SubList is 1,so the first element of the query result list can't be accessed. SELECT vendor.order FROM OrderVendor vendor WHERE vendor.user.id=? ORDER BY vendor.order.creationTime desc select order1_.order_id as order1_18_...

MS Access query with dynamic from statements

Ok this is vexing me. I have a query I created with an in statement in the from clause. What I am looking to do is have a global variable populate that from statement. Example Select * Form query1 in <Global Variable filename> What is going on is I link to a file that has hundreds of linked table and queries in it. My database only ha...

SQL Server Error: "%" is not a constraint. Could not drop constraint. See previous errors.

I'm using Microsoft SQL Server 2005, and am relatively new to SQL in general. There is a relationship between two tables, "Resources" and "Group_Resources", in the database "Information". Resources has a foreign key, "id", in Group_Resources, named "resource_id". There is a foreign key constraint, "fk_gr_res_resources", between the tw...

MySQL slow query with join even though EXPLAIN shows good plan

Hi, I have the following scenario: In a MySQL database, I have 2 MyISAM tables, one with 4.2 million rows, and another with 320 million rows. The following is the schema for the tables: Table1 (4.2M rows) F1 INTEGER UNSIGNED NOT NULL PRIMARY KEY f2 varchar(40) f3 varchar(40) f4 varchar(40) f5 varchar(40) f6 smallint(6) f7 smallint(6) ...

Hibernate:: query.list always contains the records of the first entry of the list

In the Database: TIMESTAMP DEVICE_ID SRC_ADDR PKTS_FWDED ------------------------------------------- 2010-08-10 11:45:07.547 4 2887253771 3 2010-08-10 11:45:09.547 4 2887253771 18 output of Hibernate: TIMESTAMP = 2010-08-10 11:45:07.547 DEVICE_ID: 4 SRC_ADDR: 2887253771 PKTS_FWDED 3 TIMESTAMP = 2010-08-10 11:45:07.547 DEVICE_ID...

How can i perform this query in NHibernate for getting child count

select name, (select count(*) from products where products.category_Id=categories.Id) as productCount from categories session.CreateCriteria<Category>() but whats next? i don't even know how to search it in Google? ...

Is there a query that will return all of the column names in a Microsoft Access table?

I have a Microsoft Access database that I connect to with the Jet Database Engine, using VB.NET. I want to programmatically get all of the column names for a particular table. I would like to do the equivalent of this MS SQL statement: SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = 'TableName' Is this possible...

SIMPLE MySQL Join question...

Hello again! I'm a complete newbie to SQL, and I am having problems with what I assume is an easy easy SQL join statement. I have an "inventory" and an "items" table. The "inventory" table contains a user_id, an item_id, and a qty. The "items" table contains an item_id and and item_name. I want a user to get a list of all inventory ...

What SQL data type does Oracle assign to "count(*)"?

What SQL data type does Oracle assign to count(*) in a query like select count(*) from table? Does this depend on the count size? ...

[SQL] how to query and group by specific attribute?

I have some data that store in my DB such as: id nid name 1 111 john 2 111 bill 3 222 tom 4 111 boy 5 111 girl 6 111 tim 7 333 jone 8 222 mike . . . and I need to query all id and then grouping all by nid. the expected result is id nid name 1 111 ...

PHP/mysql: querying MySQL with an array and getting results in an array

I have an array, $scans. I want to query MySQL with all the values in that array and get my results back in an array. For example, sample data in scans would be: E1234 E2244 E3654 The MYSQL table PARTS has fields part, size, length, plate, side, type. I want to end up with $output["E1234"][0] to be the size result for that part, 1 t...

Retrieve xml from MySQL

Hi all, I'm a noob at C++ and MySQL and I only want to retreive a xml file stored as a longblob in MySQL. I did a SELECT query to get the content and after I store this content in a xml file with std::ofstream. With this i get: <?xml version="1.0" encoding="UTF-16"?> <AnObject noNamespaceSchemaLocation... instead of this: <?xml vers...

HIbernate Query returning incorrect records when used with Composite Keys

class Mstatkey // This defines the coomposite key over the columns deviceid, groupaddr, srcaddr @Embeddable public final class MstatKey implements Serializable { private Integer associatedNetDeviceId; private Long groupAddr; private Long sourceAddr; .... // Here we use the composite key class Mstat @NamedQuery( ...