query

Query with multiple IN-statements but without the cartesian product

How could I make this kind of query e.g. in MySQL SELECT * FROM Table t WHERE t.a IN (1,2,3) AND t.b IN (4,5,6) AND t.c IN (7,8,9) ... so that the result would contain only the three rows: t.a|t.b|t.c ---+---+--- 1 | 4 | 7 2 | 5 | 8 3 | 6 | 9 The above query of course returns all the combinations of the values in the IN claus...

Return segmented average from SQL Query?

Hi, I measure the load on DNS servers every minute and store that into an SQL DB. I want to draw a chart of the load for the last 48 hours. That's 69120 (48*24*60) data points but my chart's only 800 pixels wide so to make things faster I would like my SQL query to return only ~800 data points. It's seems to me like a pretty standard t...

Excel and SQL, order by help

Im stuck in Excel 2007, running a query, it worked until I wanted to add a 2nd row containing "field 2". Select "Site Updates"."Posted By", "Site Uploaded"."Site Upload Date" From site_info.dbo."Site Updates" Where ("Site Updates"."Posted By") AND "Site Uploaded"."Site Upload Date">={ts '2010-05-01 00:00:00'}), ("Site Location"='Chicago...

mysql query optimization

I would need some help on how to optimize the query. select * from transaction where id < 7500001 order by id desc limit 16 when i do an explain plan on this - the type is "range" and rows is "7500000" According to the some online reference's this is explained as, it took the query 7,500,000 rows to scan and get the data. Is there an...

Making rows in to colums using sql query

I have a temp table in which have one coloum with four rows. Table ------ vaibhav IBM 12 'T' I need a temp table Col1 Col2 Col3 Col4 ------ ----- ----- ------ Vaibhav IBM 12 'T' Do anyone have any idea. ...

Will Google index my site like this?

Suppose I have a URL in my query string. Someone told me that Google does not like it because they believe we are pulling content from another server. http://mydomain.com/?id=http://abc.com ...

Google App-Engine Java Filtering on more than 3 columns

public List<Orders> GetOrders(String email,String icode,String c1, String c2, String c3) { PersistenceManager pm = PMF.get().getPersistenceManager(); Query query = pm.newQuery(Orders.class); query.setFilter("Email == pEmail && ItemCode == pItemCode && Col1 == pCol1 && Col2 == pCol2 && Col3 == pCol3"...

Complex query with two tables and multilpe data and price ranges

Let's suppose that I have these tables: [ properties ] id (INT, PK) name (VARCHAR) [ properties_prices ] id (INT, PK) property_id (INT, FK) date_begin (DATE) date_end (DATE) price_per_day (DECIMAL) price_per_week (DECIMAL) price_per_month (DECIMAL) And my visitor runs a search like: List the first 10 (pagination) properties ...

what is the best way to get user name by id with FQL

hello im trying to query with facebook notification table using FQL im getting the user_id but how can i get result and get the user name in the same FQL query? ...

Yahoo Query Language Problem

Hello everybody! Today, I've started with Yahoo Query Language. I would use it to retrive stocks details, so I'm talking about Yahoo Finance. I think there is a bug on this language. This is my query: select * from yahoo.finance.quoteslist where symbol='@^GSPC' I ALWAYS get 51 results! it's impossible, take a look at: http://...

SQL Query: Using IF statement in defining new field

I have a table with many fields and additionally several boolean fields (ex: BField1, BField2, BField3 etc.). I need to make a Select Query, which will select all fields except for boolean ones, and a new virtual field (ex: FirstTrueBool) whose value will equal to the name of the first TRUE Boolean Field. For ex: Say I have BField1 = F...

mySQL query : working with INTERVAL and CURDATE

Hello, i'm building a chart and i want to recieve data for each months Here's my first request which is working : SELECT s.GSP_nom AS nom, timestamp, AVG( v.vote + v.prix ) /2 AS avg FROM votes_serveur AS v INNER JOIN serveur AS s ON v.idServ = s.idServ WHERE s.valide =1 AND v.date > CURDATE() -30 GROUP BY s.GSP_nom ORDER BY avg DE...

XPATH Query: How to get two elements?

Hello My HTML code is: <table> <tr> <td class="data1"><p>1</td></td> <td class="data1"><p>2</td></td> <td class="data1"><p>3</td></td> <td class="data1"><p>4</td></td> </tr> <tr> <td class="data1"><p>5</td></td> <td class="data1"><p>6</td></td> <td class="data1"><p>7</td></td> <td class="data1"><p>8</td></td> </tr> </table> My query ...

Group mysql query by 15 min intervals

I've got a monitoring system that is collecting data every n seconds (n ~=10 but varies). I'd like to aggregate the collected data by 15 minute intervals. Is there a way to corral the timestamp column into 15 minute chunks to allow for grouping to work? ...

can I get count() and rows from one sql query in sql server?

I'd like to get the total count of results and top n rows of some query - is it possible in one statement? I'd expect the results as: count(..) column1 column2 125 some_value some_value 125 some_value some_value Thank you in advance! ...

LINQ Query with 3 levels

I have a business object structured like this: Country has States, State has Cities So Country[2].States[7].Cities[5].Name would be New York Ok, I need to get a list of all the Country objects which have at least 1 City.IsNice == true How do I get that? ...

Rails 3 find all associated records has_many :through

I would like to list all posts that are connected with some specific category and classroom. I have: class Post < ActiveRecord::Base has_many :category_posts has_many :categories, :through => :category_posts has_many :classroom_posts has_many :classrooms, :through => :classroom_posts end class Category < ActiveRecord::Base h...

looking for word parts with full text search in sql server

how do I find, with full text search all words that match 'ability' mask, like "suitability" and "dependability", etc? is that possible? ...

Windows Azure: need to know the data processing time

I have stored some files in the form of blobs on azure and I have written an application that would access these blobs. When I host this application as a web role on azure, it works perfectly and I am happy with that. But now, I wanted to know “what is the query time taken to access each blob file?” I was searching for this thro...

SQL Query with multiple values in one column

I've been beating my head on the desk trying to figure this one out. I have a table that stores job information, and reasons for a job not being completed. The reasons are numeric,01,02,03,etc. You can have two reasons for a pending job. If you select two reasons, they are stored in the same column, separated by a comma. This is an examp...