query

[Linq to sql] query result what should i use Count() or Any()...

I am checking login of a user by this repository method, public bool getLoginStatus(string emailId, string password) { var query = from r in taxidb.Registrations where (r.EmailId == emailId && r.Password==password) select r; if (query.Count() != 0) { retur...

Cannot use a Like query in a JDBC prepared statement?

OK, first the query code and query: ps = conn.prepareStatement("select instance_id, ? from eam_measurement where resource_id in (select RESOURCE_ID from eam_res_grp_res_map where resource_group_id = ?) and DSN like '?' order by 2"); ps.setString(1,"SUBSTR(DSN,27,16)"); ps.setInt(2,defaultWasGroup); ps.setString(3,"%Module=jvmRuntimeModu...

How do I get PHP variables from this MySQL query?

I am working on an Asset Database problem using PHP / MySQL. In this script I would like to search my assets by an asset id and have it return all related fields. First I query the database asset table and find the asset's type. Then depending on the type I run 1 of 3 queries. <?php //make database connect mysql_connect("localhost...

SQL Server query

Hi, I have a SQL Server DB containing a registrations table that I need to plot on a graph over time. The issue is that I need to break this down by where the user registered from (e.g. website, wap site, or a mobile application). the resulting output data should look like this... [date] [num_reg_website] [num_reg_wap_site] [num_reg_m...

Sqlite problem doing a Query

Hi all. Im triying to do a query on sqlite. I want to retrieve the server id of the servers that are not associated with a profile id (i have the id of the profile). The table serpro represents the n:n relationship betwen the tables. This is my query (apparently it is wrong): "Select server._id, server.server from server where server._...

JPA Native Query delete in

Hello, I try to delete a list of rows from a table using this Native Query: @NamedNativeQuery(name="WebGroup.DeleteIn", query="DELETE FROM WebGroup WHERE WebGroup.GROUP_ID IN (:IDsList)" getEm().createNamedQuery("WebGroup.DeleteIn") .setParameter("IDsList", groupToDeleteIDs) .executeUpdate();...

Please clear up this django query question

Hi, I have developed a few Django apps, all pretty straightforward in terms of how I am interacting with the models. I am building one now that has several different views which for lack of a better term are "canned" search result pages. These pages all return results from the same model, but they are filtered on different columns. One...

Hibernate ResultTransformer with JPA API

Has anyone figured out a smart way to do query result transformation through a similar mechanism like specifying a ResultTransformer in Hibernate? All I can think of is transforming each result row after it has been returned by the Query. Is there any other way? For constructor projections (e.g. new DTO(arg1, arg2)) it can be defined i...

How to loop through an array return from the Query of Mysql

This might be easy for you guys but i could't get it. I have a php class that query the database and return the query result. I assign the result to an array and wants to use it on my main.php script. I have tried to use echo $var[0] or echo $var[1] but the output are 'array' instead of my value. Anyone can help me about this issue? Th...

Del.icio.us get xml of all posts

Im trying to get all of my posts in a delicious account to an MySql DB. Since delicious exports xml I think it wont be too complicated, but being new to it I cant really make sense of the api... I believe I have to query it as so: https://api.del.icio.us/v1/posts/all? But one catch is that im using an yahoo id for that account whic...

SQL query for active users

This SQL query gives me today's number of users active in the last 30 days: SELECT COUNT(*) FROM table.users WHERE creation_tsz >= (now() - interval '30 days') How can I modify it to get not a single value, but a table of active users for a range of dates? My desired output would look like this: Date Users active in the las...

MySQL Query, Date Range From "Blacklist"

I have 2 databases. One is properties and the other is dates. In dates I have associated the land_id and a date (In YYYYMMDD format) which means that the date is not available. I need to formulate a query that a user can specify a start and end date, and then choose a property for which dates are available (not in the date database). H...

MySQL select two tables at the same time...

Hi all I have two tables and want to make a query. I tried to get team AA and team BB's image base on table A. I used: SELECT tableA.team1, tableA.team2, tableB.team, tableB.image, FROM tableA LEFT JOIN tableB ON tableA.team1=tableB.team The result only display imageA on the column. Are there any ways to select imageA and i...

PostgreSQL - Why are some queries on large datasets so incredibly slow

Hello, I have two types of queries I run often on two large datasets. They run much slower than I would expect them to. The first type is a sequential scan updating all records: Update rcra_sites Set street = regexp_replace(street,'/','','i') rcra_sites has 700,000 records. It takes 22 minutes from pgAdmin! I wrote a vb.net function...

getting userbase vote average and individual user's vote in the same query?

Here goes: T1 [id] [desc] 1 lovely 2 ugly 3 slender T2 [id] [userid] [vote] 1 1 3 1 2 5 1 3 2 2 1 1 2 2 4 2 3 4 In one query (if possible) I'd like to return: T1.id, T1.desc, AVG(T2.vote), T2.vote (for user viewing the page) I can get the first 3 i...

Update query (access & vb.net)

Hi: QUESTION 1 I have to update some fields of a table of access according to the value of parameter. If this paramter is "true" I need to update. Table idInvoice price percentageTax1 tax1 percentageTax2 tax2 total Example values: idinvoice: 12300 price: 100 € percentageTax1: ...

Info on Seam's EntityQuery?

I've been working with Seam and JPA/Hibernate for quite some time, but have just started looking at making use of the EntityHome and EntityQuery classes more. EntityHome seems relatively straightforward in terms of what it is and how I can leverage it. But, EntityQuery is a bit less clear. I understand the ability to grab, for example...

T-SQL Query to Get SUM(COUNT())

Hi, I am planning to get a report for a table with following table structure: ID RequestDate ----------------------------- 1 2010/01/01 2 2010/02/14 3 2010/03/20 4 2010/01/07 5 2009/03/31 I want the results as: I D_Count RequestDate S...

How to query through a DBRef in MongoDB/pymongo?

Is it possible to query through a DBRef using a single find spec? user collection { 'age': 30 } post collection { 'user': DBRef('user', ...) } Is it possible to query for all post who's users are 30 in a single find step? If not, would it be wise to create a javascript function to handle the multi-stage operation or will ...

Recursive COUNT Query (SQL Server)

Hello Guys! I've two MS SQL tables: Category, Question. Each Question is assigned to exactly one Category. One Category may have many subcategories. Category Id : bigint (PK) Name : nvarchar(255) AcceptQuestions : bit IdParent : bigint (FK) Question Id : bigint (PK) Title : nvarchar(255) ... IdCategory : bigint (FK) How do I re...