Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > Oracle
Oracle General Oracle database discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Oracle section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 14th, 2010, 07:24 AM
Authorized User
Join Date: Sep 2008
Posts: 54
Thanks: 8
Thanked 1 Time in 1 Post
Default How to use 'HAVING' without 'GROUP BY'?


'Having' can be used without 'Group by' as well, table has the data but this query is not returning any answers is there anything wrong with this query?


Please do guide in Oracle and in SQL.

Thanks in advance
How to do programming?
Old October 15th, 2010, 03:31 AM
joefawcett's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts

If the parser doesn't complain about syntax errors then it looks fine (but I'm no expert on PL/SQL).
Can you give some DDL and DMl to create and populate a table with some sample data so we can try this ourselves?
Old March 9th, 2011, 04:07 AM
Registered User
Join Date: Mar 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

I think, if the data exist, your query should be good
Old March 9th, 2011, 07:33 AM
Authorized User
Join Date: Sep 2008
Posts: 54
Thanks: 8
Thanked 1 Time in 1 Post
Default Logical error, as I wanted to have some of account_type less than or equal to 0

There was a logical error in my query as I wanted to use sum function for those account_type whose values are less than or equal to 10,

but the above query actually doing sum with all records of
account_type, and answer was not showing because there sum was above 10.

So either I have to use subquery or I don't know how much I can play with this query to have my desired result.

How to do programming?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Group by rajesh_css SQL Language 2 February 17th, 2009 08:41 AM
Group Within another Group, xslt1.0 jhansib4u BOOK: XSLT Programmer's Reference, 2nd Edition 4 November 22nd, 2007 01:24 AM
Restart new group number in Group Footer sukarso Crystal Reports 2 October 13th, 2006 12:11 PM
Group by , Sub Group by and Sum mateenmohd SQL Server 2000 1 March 29th, 2005 09:51 AM
GROUP BY... then sub group? mr.smith Classic ASP Basics 8 November 26th, 2003 09:40 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.