Home Discussion Discuss: Writing Subqueries

  • need some help with a queryAlejandro September 22, 2011 at 5:56 PM

    I have a table "A" that have many rows with fields linking tables "B" and "C" this fields (called "A.b" and "A.c") are the rowids of tables "B" and "C" respectively. Inside tables "B" and "C" there are fields called "date-b" and "date-c" respectively. have that said...what I need is a list of "A.b" that mets the following conditions: "date-b" should be after an specific date, and "date-c" should be before an specific date... Any help whopuld be really appreciated.... Many thanks in advance

  • subqueriesPaul September 23, 2011 at 12:02 AM

    thanks for this, i had been struggling all day to understand subqueries and given that mysql.com utterly useless this article helped me out alot. thank you.

  • queriesveni January 28, 2012 at 11:43 AM


  • dbmsswapna March 22, 2012 at 3:43 PM

    its very nice we can understand easily but to know the second max wt is the query is required ?

  • Subquery syntax errorAgus Wahyudi June 4, 2012 at 9:16 PM

    Would you please correct an error #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '" + " ,mstr_customer cus" + " ,(' at line 1 on code : SELECT pj.faktur,pj.tanggal,cus.nama,fk.bayar" + " FROM ttrs_penjualan pj" + " ,mstr_customer cus" + " ,( SELECT sum( (prd.harga * pd.qty) - ((prd.harga * pd.qty) * (pd.diskon/100))) as bayar,pd.faktur" + " FROM ttrs_penjualan_detail pd" + " ,mstr_product prd" + " WHERE pd.prd_id=prd.prd_id" + " GROUP BY pd.faktur ) fk" + " WHERE pj.faktur=fk.faktur" + " AND pj.cust_id=cus.cust_id Thanx anyway.

  • SubquriesAjit June 23, 2012 at 11:10 AM

    thank u?

  • MYSQLsampath July 30, 2013 at 12:06 PM

    Inner Query for insert a record in one table after deletion that record in another table in mysql

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
Related Articles
Hibernate Tutorial Example

Hibernate Subqueries
Hibernate Subqueries       In this section, you will learn about the subqueries with an appropriate example. Subqueries in hibernate can be referred 


Hibernate Subqueries Example
Hibernate Subqueries Example In this tutorial you will learn about HQL subqueries. A query that is written within a databases supported query is called subquery. A subquery is surrounded by parentheses. Subqueries are generally written 


Writing Subqueries
Writing Subqueries      ... or subselects also. Subqueries don?t include any new functionality but the queries are more readable with using subqueries rather than of joins. We will describe 


Hibernate Criteria Detached Subquery Using "Subqueries"
write the subqueries. Writing method of subquery using DetachedCriteria is just... Subqueries. In Hibernate Criteria with the help of DetachedCriteria a query can... in subqueries. for example DetachedCriteria avgAge = DetachedCriteria.forClass 


Hibernate Detached Criteria Subquery
In this section we will discuss how to write subqueries using Detached Criteria in Hibernate 

Hibernate Tutorial Example

Hibernate Query Language
of following elements: Clauses Aggregate functions Subqueries Clauses......) Subqueries Subqueries are nothing but its a query within another query. Hibernate supports Subqueries if the underlying database supports it.   

SQL Question

What is Correlated Subquery ?
with two subqueries: select stu_name , stu_mark , ( select avg(stu_mark) from 


MySQL Database Training
Multiple Conditions  Writing SELECTs with Multiple Conditions...; Subqueries, Joins, and Unions 


Hibernate Tutorials
Hibernate Query Language Developing POJO class Hibernate Subqueries 


Sitemap Spring Framework Tutorial
Procedures and Functions  | Writing Subqueries | Flow Control Constructs 


MySQL Training ? Online Free MySQL Training
statements.   Writing Subqueries A subquery can be defined as a query... MySQL 5.0 which is the latest version of MySQL at the time of writing tutorial... are allowed for writing expressions in MySQL. If any expression, which contains NULL 


Welcome to the MySQL Tutorials
statements.   Writing Subqueries... at the time of writing tutorial. Introduction... are allowed for writing expressions in MySQL. If any expression, which 


Sitemap Hibernate Tutorial
and Joins | Hibernate Aggregate Functions | Hibernate Subqueries...; | Emitting DOCTYPE Declaration while writing XML File  | Handling Errors While 

Hibernate Tutorial Example

Complete Hibernate 3.0 and Hibernate 4 Tutorial
Subqueries In this section, you will learn about the subqueries... Hibernate tutorial    Writing... and integrate it with the Struts.   Writing Web 


Complete Hibernate 4.0 Tutorial
Hibernate Subqueries Example Hibernate