query

all combination output in mysql

I have three tables: table1, table2, table3. Table1 contains: Title1 desc LHR LONDON HEATHROW LGW LONDON GATWICK Table2 contains: Title2 desc2 W1 TESTW1 W2 TESTW2 Table3 contains: vehicle desc3 SALOON SALOON DESC VIP VIP DESC EXECUTIVE EXECUTIVE DESC I want to output all combinations like t...

How do you return certain properties from a linq query, rather than complete objects?

Hi all I've just downloaded the Linq provider for NHibernate and am just a little excited. But I don't know Linq syntax that well. I can return whole objects from a query like this: var query = from foo in session.Linq<Kctc.BusinessLayer.Domain.Case>() where foo.CaseNumber > 0 select foo; And I ca...

One-to-Many Table Join?

I have one table (webRooms) which has a number of rows which match those in a second table (Residency). Table 1 looks like this: ID | dorm_building | dorm_room | occupant_num Table 2 looks like this: student_ID | dorm_building | dorm_room What I'd like is to get results like this: ID | dorm_building | dorm_room | o...

How to use KDTree to make top-k query and range query on arbitrary dimensions

Hi, I have used KD-tree(libkdtree++) to store a multi-dimensional data set, and the requirements here is this data set can support top-k/range queries on different dimensions. For example, a KDTree<3, Point> tree: to find the top 100 points whose have highest Point[1](y axis) values. From the implementation of libkdtree++, what's sim...

Outer Join with Where returning Nulls

Hi I have 2 tables. I want to list all records in table1 which are present in table2 all records in table2 which are not present in table1 with a where condition Null rows will be returned by table1 in second condition but I am unable to get the query working correctly. It is only returning null rows SELECT A.CLMSRNO,A.CLMPLAN...

NHibernate HQL vs CriteriaAPI vs QueryOver. Performance.

Hi, What are the performance differences between the hql and criteriaApi and QueryOver? Are there any situations where one is faster or slower than the other? Edit: I extended the question with QueryOver. ============================================= Well, I am not sure which response to mark as answer so I will mark posts with most ...

In Rails, how to get the actual Query when an ActiveRecord query executes

Hi, I am using a simple query in ActiveRecord which does something like this. MyTable.find(:all, :conditions => {:start_date => format_time(params[:date]) }) I want to get the equivalent query that is executed in the background, perhaps using a puts statement or something similar to that. MySQL is my database. ...

Mysql join query for multiple "tags" (many-to-many relationship) that matches ALL tags?

I am trying to query for Objects that match ALL of a given set of Tags. Basically I want users to be able to add on more and more Tags to filter or "narrow down" their search results, kind of like newegg.com does. My table structure is a table of Objects, a table of Tags, and a MANY:MANY relation table ObjectsTags. So I have a JOIN qu...

run sql query from two tables with where clause from one table

I want to get records from one table based on a record from another table. They both have SSN fields and I want to link them by SSN. Here is a rough example what I want to get: SELECT SUM(Table1.Payments) FROM Table1 WHERE Table1.SSN = Table2.SSN AND Table2.City = 'New York' I want to get the sum of the payments by a variable...

Help with asp login SQL

I have a form which goes to the following login script when it is submitted. <% Dim myConnection As System.Data.SqlClient.SqlConnection Dim myCommand As System.Data.SqlClient.SqlCommand Dim requestName As String Dim requestPass As String requestName = Request.Form("userName") requestPass = Request.Form("userPass"...

Sort mySQL table's fields

So lets say I have a table (lets say 50 rows, 50 columns) that I occasionally have to make tiny edits to. While I realize I could be (maybe some of you will tell me I should be) using the query to do this, I like using a database management program (like Sequel Pro) to make changes by hand. So I have two questions: When you do a query ...

MS Access Pass Through Query find duplicates using multiple tables

I'm trying to find all coverage_set_id with more than one benefit_id attached summary_attribute (value=2004687). The query seems to be working fine without the GROUP BY & HAVING parts, but once I add those lines in (for the COUNT) my results are incorrect. Just trying to get duplicate coverage_set_id. Pass-Through Query via OBDC datab...

SQLite and Android. How do I use String Having in my query??

I have a query that pulls everything from a database into a list view. return mDb.query(DATABASE_TABLE, new String[] {KEY_ROWID, KEY_HEIGHT, KEY_BODY, KEY_HOMEID},null , null, null, null, null,null); | String Having is the 3rd from ...

SQLite query where clause with floating point numbers fails?

I'm putting a float in an Android based SQLite database, like so: private static final String DATABASE_CREATE = "create table " + DATABASE_TABLE + " (" + KEY_ID + " integer primary key autoincrement, " + KEY_FLOAT + " REAL, " + ... ... content.put(KEY_FLOAT, 37.3f); db.insert(DATABASE_TAB...

Do you know any website which allow query execution?

Hi all, I wanted to know if there is any system which allow me to create my own tables and execute query on those tables? I want these because I don't have any database installed on my office computer and I want to practice queries in my free time. ...

how to add WHERE clause to Query on android

I would like to limit the results to those whose KEY_HOMEID is equal to journalId. I've been on this for a couple days any help would be appreciated. public Cursor fetchAllNotes(String journalId) { return mDb.query(DATABASE_TABLE, new String[] {KEY_ROWID, KEY_HEIGHT, KEY_BODY, KEY_HOMEID},"FROM DATA...

How to use logical OR in SPARQL regex()?

I'm using this line in a SPARQL query in my python program: FILTER regex(?name, "%s", "i" ) (where %s is the search text entered by the user) I want this to match if either ?name or ?featurename contains %s, but I can't seem to find any documentation or tutorial for using regex(). I tried a couple things that seemed reasonable: FILT...

MYSQL query help (EAV Table)

I have the following query to retrieve customers who answer YES to a particular question "OR" NO to another question. SELECT customers.id FROM customers, responses WHERE ( ( responses.question_id = 5 AND responses.value_enum = 'YES' ) OR ( responses.question_id = 9 AND responses.value_enum = 'NO' ) ) GROUP BY customers.id Which works ...

SQL Concat Query

I have two tables like this: TABLE user( id CHAR(100) text TEXT ) TABLE post( postid CHAR(100) postedby CHAR(100) text TEXT FOREIGN KEY (postedby) references user ); I need a query that for each user concatenates the TEXT column of all posts of that user and put them in the text column of the user. the order is not ...

Find Missing Pairs in SQL

Assume there's a relational database with 3 tables: Courses {name, id}, Students {name, id}, Student_Course {student_id, course_id} I want to write an SQL that gives me the student-course pairs that do NOT exist. If that is not feasible, at least it'd be good to know if there are missing pairs or not. Also, since this is a small part...