query

Query not returning rows in a table that don't have corresponding values in another [associative] table

I have Table: ARTICLES ID | CONTENT --------------- 1 | the quick 2 | brown fox 3 | jumps over 4 | the lazy Table: WRITERS ID | NAME ---------- 1 | paul 2 | mike 3 | andy Table: ARTICLES_TO_WRITERS ARTICLE_ID | WRITER_ID ----------------------- 1 | 1 2 | 2 3 | 3 To summarize, article 4 has no w...

Problem reading from 3 tables in mysql

What do I do, I need to fetch data from 3 tables in mysql, here is my current query. All of the tables contain the IDNO which has 03A45 number. But this query isnt returning any results: SELECT * FROM father, mother, parents WHERE father.IDNO=mother.IDNO=parents.IDNO AND mother.IDNO='03A45' AND father.IDNO='03A45' AND p...

How to see this format hh:mm from hh:mm:ss in SQL Server 2008 query ?

Hi How to see this format hh:mm from hh:mm:ss in SQL Server 2008 query ? Thanks in advance ...

Join query in doctrine symfony

I have two tables userdetails and blog question The schema is UserDetails: connection: doctrine tableName: user_details columns: id: type: integer(8) fixed: false name: type: string(255) fixed: false BlogQuestion: connection: doctrine tableName: blog_question columns: question_id: ...

how does a SQL query work?

How does a SQL query work? How does it get compiled? Is the from clause compiled first to see if the table exists? How does it actually retrieve data from the database? How and in what format are the tables stored in a database? I am using phpmyadmin, is there any way I can peek into the files where data is stored? I am using MySQL ...

need to read data from oracle database with many conditions

hi! i have 3 tables A,B and C. table A has column employee_name,id table B is the main table and has columns id,os version. table c has the columns id,package id and p_version. I want to query the count of employee_name where the id of table a and c are matched with id of table b(which is the main table). I should also get the names...

mysql subquery strangely slow

I have a query to select from another sub-query select. While the two queries look almost the same the second query (in this sample) runs much slower: SELECT user.id ,user.first_name -- user.* FROM user WHERE user.id IN (SELECT ref_id FROM education WHERE ref_type='user' ...

How can one fetch partial objects in NHibernate?

Dear ladies and sirs. I have an object O with 2 fields - A and B. How can I fetch O from the database so that only the field A is fetched? Of course, my real application has objects with many more fields, but two fields are enough to understand the principal. I am using NHibernate 2.1. Thanks. EDIT: I wish to clarify. I need to fet...

Help constructing query - Compare columns and replace numbers

I have a feeling that this query is pretty easy to construct, I just can't figure it out. I want to replace all numbers in table X column C, with numbers in table Z column A, where numbers from table X column C matches numbers in table Z column B. I hope that makes sense. Perhaps a little background information will make it clearer. I'...

IDs necessary in update script not being stored (or even seen!?) (PHP MySQL)

Hi guys, I really need help with this one...have spent 3 hours trying to figure it out... Basically, I have 3 tables necessary for this function to work (the query and PHP)... Authors, Books and Users. An author can have many books, and a user can have many books - that's it. When the admin user selects to update a book, they are pres...

Explicit disable MySQL query cache in some parts of program

In a Django project, some cronjob programs are mainly used for administrative or analysis purposes, e.g. generating site usage stats, rotating user activities log, etc. We probably do not hope MySQL to cache queries in those programs to save memory usage and improve query cache efficiency. Is it possible to turn off MySQL query cache...

Date & time query question (SQL Server 2008)

hi I have table that contain date and time field. id|date|time ========= 1|01/01/2001|10:45 2|01/02/2002|11:45 3|01/03/2003|12:45 4|01/04/2004|12:55 I need to know the difference between the MAX(date) and the MIN(date) And the MAX(time) and the MIN(time) Something like.... MAX(date)-MIN(date) ???..... Thanks in advance ...

Need some help with a MySQL subquery count

I'm running into my own limits of MySQL query skills, so I hope some SQL guru can help out on this one. The situation is as follow: I have images that can be tagged. As you might expect this is stored in three tables: Image Tag Tag_map (maps images to tags) I have a SQL query that calculates the related tags based on a tag id. The q...

how to combine the related version in group by

select count(a),b,c from APPLE join MANGO on (APPLE.link=MANGO.link) join ORANGE on (APPLE.link=ORANGE.link) where id='camel' group by b,c; the column b gives values like 1.0 1.0,R 1.0,B 2.0 2.0,B 2.0,R 3.0,C 3.0,R is there a way to modify the above quer so that all 1.0 and 1.0,R and 1.0,B are merged as 1.0 and 2.0,2.0,B are...

Expression engine! MySQL query for entry/expiration date range

I’ve built a site in ExpressionEngine for some holiday apartments (EE1.6.8), that uses two related weblogs for bookings. ‘apartments’ & ‘booking’ Bookings are set up as weblog entries using the entry_date for arrival and expiration_date for leaving date, and are related back to the apartment that is booked. I’ve built a page that list...

C# - Google like query engine.-

Guys; Hope you are fine. I have to make a Web Project (very simple) I will have a DB with 2 tables. One table has 2 fields. From the WebPage I need a Google like search query, for example I have Movie Title and Movie Review on the Table. I need to be able to search those 2 fields like this: "Best Movie" + Action I will need to...

Which method is best method for speed? in SQL Server, stored procedure

I have select, insert, update and delete query. If I have to write all queries in the same stored procedure that is good for performance or should I write all queries in separate stored procedures? ...

specify query timeout when using toplink essential query hint

Hi, For glassfish v2, I have searched through the web and I cannot find anyway to specify query timeout when using TopLink essential query hint. We have another option to migrate to EclipseLink but that is not feasible. have tried the solution in http://forums.oracle.com/forums/thread.jspa?threadID=974732&tstart=-1 but it seems the ...

Manipulate data in the DB query or in the code

How do you decide on which side you perform your data manipulation when you can either do it in the code or in the query ? When you need to display a date in a specific format for example. Do you retrieve the desired format directly in the sql query or you retrieve the date then format it through the code ? What helps you to decide : p...

Is it possible to select data with max value for a column using Criteria in Hibernate?

Lets say I have the following mapping: <hibernate-mapping package="mypackage"> <class name="User" table="user"> <id name="id" column="id"> <generator class="native"></generator> </id> <property name="name" /> <property name="age" /> </class> </hibernate-mapping> Is it possible to select the oldest user (that i...