473,395 Members | 2,796 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Why im getting wrong number of rows when using group by and limit?

Hi everybody, i'm doing a query where i want retrieve some records when i do the query without 'limit' the result returns me the correct number of rows, but when i use limit the result returns me the half of the rows. the query im using is something like this:
Expand|Select|Wrap|Line Numbers
  1. SELECT
  2. WGI_TaxoName.ScientificName,          
  3. WGI_Locality.Locality,
  4. IFNULL(CONCAT(GROUP_CONCAT(IFNULL(CONCAT(wgi_agent.lastname,", ",wgi_agent.firstname),wgi_agent.lastname) SEPARATOR "; "),"; ",GROUP_CONCAT(wgi_agent.name SEPARATOR "; ")),          IFNULL(GROUP_CONCAT(IFNULL(CONCAT(wgi_agent.lastname,", ",wgi_agent.firstname),wgi_agent.lastname) SEPARATOR "; "),GROUP_CONCAT(wgi_agent.name SEPARATOR "; "))) as Collector
  5. FROM
  6. WGI_CollectionObject
  7. INNER JOIN WGI_CollectingEvent ON (WGI_CollectionObject.CollectingEventID=WGI_CollectingEvent.CollectingEventID)
  8. INNER JOIN WGI_Determination ON (WGI_Determination.CollectionObjectID=WGI_CollectionObject.CollectionObjectId)
  9. INNER JOIN WGI_Locality ON (WGI_CollectingEvent.LocalityID=WGI_Locality.LocalityID)
  10. INNER JOIN WGI_TaxonName ON (WGI_Determination.TaxonNameID=WGI_TaxonName.TaxonNameID)
  11. LEFT OUTER JOIN WGI_Geography ON (WGI_Locality.GeographyID=WGI_Geography.GeographyID)
  12. LEFT OUTER JOIN wgi_collectors ON (wgi_collectors.CollectingEventID=WGI_CollectingEvent.CollectingEventID)
  13.  LEFT OUTER JOIN wgi_agent ON (wgi_collectors.AgentID=wgi_agent.AgentID)
  14. WHERE
  15. (wgi_taxonname.NombreCientifico = "XXX") AND (wgi_taxonname.Genero = "XXX") 
  16. GROUP BY 
  17. WGI_CollectionObject.CollectionObjectId,      
  18. ORDER BY ScientificNumber
  19. LIMIT 0,10
  20.  
This query returns me 5 rows and the result should be 10 rows, when i do the query without limit it returns me 10 rows and i dont know why is this happening.

Sometimes the resulting ammount of rows is different i think it depends of the total row count of the query

Thanks for the help.
Jul 15 '10 #1
1 1873
djpaul
137 100+
Hey Grodon57,
Does the comma need to be there after WGI_CollectionObject.CollectionObjectId,?

Expand|Select|Wrap|Line Numbers
  1. # GROUP BY 
  2. # WGI_CollectionObject.CollectionObjectId,      
  3. # ORDER BY ScientificNumber
  4. # LIMIT 0,10
Jul 15 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Kathryn | last post by:
Good morning! I am having a problem with a span. I have items, of which I only want to show the first X characters on the screen. If the user prints the page, I want the entire item to print....
7
by: Egor Shipovalov | last post by:
I'm implementing paging through search results using cursors. Is there a better way to know total number of rows under a cursor than running a separate COUNT(*) query? I think PostgreSQL is bound...
0
by: Bruce | last post by:
Is there any way to determine a registry key's type (DWORD, string, multi-string, etc.) when using the RegistryKey class to read keys? Bruce
4
by: Peter | last post by:
Hi! I'm developing components (webparts) for a sharepoint site and are currently having some problems with the resource manager. The site supports two languages (English and Swedish) and when...
1
by: uveper | last post by:
Does anybody know how to get a number of rows when using DataTable with datasource that is an SqlCeResultSet. I use the following code to "select" the data into DataTable: SqlCeCommand cmd =...
5
by: bmm | last post by:
I have a Store Procedure on a Sql Server 2000 Where I use the Table Hint "NoLock" on all selects. One of my clients (OleDbConnection from C#) doesn't get the same Result Set as the others. The...
3
by: kbcompany | last post by:
Hi I have just started learning oracle. i have created a table with name imp_master and columns item_code with constraint not null, item_name with constraint n1 not null(n1 is user...
1
by: prathna | last post by:
Hi .. I have a logic:iterate tag which will display 5 rows each row with a drop downlist and 2 textfields.now by default all the rows will be shown.how do i hide all the rows except the first...
1
by: rvj | last post by:
Im sure this is dead simple but where do you find the URL causing the error ? I am trying to catch bad directory references using IIS custom errors tab It points to my error handler eg ...
3
by: James Watson | last post by:
'Microsoft VB 6.3, Access 2002 'Syntax error in the INSERT INTO Statement when the query runs 'How can I make this work? Private Sub Command52_Click() On Error GoTo Err_Command52_Click ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.