Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / March 2004

Tip: Looking for answers? Try searching our database.

problem with GROUP BY...

Thread view: 
org - 30 Mar 2004 01:25 GMT
I am using borland's JBuilder X to connect to an access database (existing
project) via odbc.

The problem is that my queries don't like the "GROUP BY" clause.
If I omit the GROUP BY clause, the table fills up correctly,
but if I include it, the query fails, with no indication of why.

I suspect that the odbc driver for access doesn't support advanced queries.
But, is there anything else I may have missed?

regards,
   DarylH.

//--- code starts here --->
void LoadVersionsDisplay(int main_id)
{
     String strSQL = "SELECT VersionNo, LastUpdated FROM Table " +
          " WHERE Table.MainID="+ String.valueOf(main_id)
          + " GROUP BY VersionNo "  // note space before 'G'
          ;

      VersionQuery.close();    // reuse this guy many times (it works)
      VersionQuery.setQuery(
               new com.borland.dx.sql.dataset.QueryDescriptor(
                   ProjectDM.getMainDatabase(), strSQL, null, false,
                   Load.ALL ) );

      VersionQuery.executeQuery();
      VersionsTable.setDataSet( VersionQuery );
}
org - 30 Mar 2004 02:33 GMT
MY BAD!!

Thanks, folks, I solved my problem.
Stoopid, basic SQL pragmatics.

select should read: "SELECT VersionNo, max(LastUpdated) AS LastModified ..."

It helps just to ask the question.
regards,
   DarylH.

> I am using borland's JBuilder X to connect to an access database (existing
> project) via odbc.
[quoted text clipped - 26 lines]
>        VersionsTable.setDataSet( VersionQuery );
> }
org - 30 Mar 2004 02:35 GMT
MY BAD!!
Thanks, folks, I solved my problem.
Stoopid, basic SQL pragmatics.

select should read: "SELECT VersionNo, max(LastUpdated) AS LastModified ..."

It helps just to ask the question.
regards,
   DarylH.

> I am using borland's JBuilder X to connect to an access database (existing
> project) via odbc.
[quoted text clipped - 26 lines]
>        VersionsTable.setDataSet( VersionQuery );
> }


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.