try in simple programming skill at 1) if your script language uses the pattern while (resultSet.next()) { out.println(resultSet.getFirstColumn(); ... ... ... counter++; } out.println("Total number of records"+counter); 2) if you do not want that, you can also try this sql = "SELECT tblTempConsolidation.*, tblCustomer.customerLibrary , "1" FROM..." insert "1" as the last returned column data before "FROM..." in your select statment. In your script, you can simply sum up the last returned column. Then total number of records is the last sum-up. ----- Original Message ----- From: "G r e g L a w r i e" <[EMAIL PROTECTED]> To: "MySQL Mailing List" <[EMAIL PROTECTED]> Sent: Tuesday, August 21, 2001 2:15 PM Subject: SELECT COUNT(*) question ... > Howdy all, > > I have two tables as described further down below ... > > I use the following query to get the data I need ... > > sql = "SELECT tblTempConsolidation.*, tblCustomer.customerLibrary FROM > tblCustomer, tblTempConsolidation WHERE tblCustomer.customerId = > tblTempConsolidation.customerId AND tblTempConsolidation.customerId =" & > Cint(intCustomerId) & ";" > > (I'm using VBScript) > > I need to know how many records this SELECT returns to me. I am > currently > doing this with a seperate SELECT COUNT(*) statement and it works fine, > however it would be nice to do the whole lot in one. The manual tells me > I > can not mix GROUP and no GROUP columns without having a GROUP BY. From > my > rather limited SQL knowledge, I suspect that I can not do this with the > data > that I have.. > > Any suggestions? TIA. > > > # > # Table structure for table 'tblCustomer' > # > > CREATE TABLE tblCustomer ( > customerId int(11) NOT NULL DEFAULT '0' auto_increment, > customerName char(10) NOT NULL DEFAULT '' , > customerPW char(10) , > customerLibrary char(50) , > customerEmail char(50) , > interfaceTypeId int(11) NOT NULL DEFAULT '0' , > customerUSMARC tinyint(4) , > PRIMARY KEY (customerId), > KEY customerName (customerName), > KEY interfaceTypeId (interfaceTypeId) > ); > > # > # Table structure for table 'tblTempConsolidation' > # > > CREATE TABLE tblTempConsolidation ( > sequence int(11) NOT NULL DEFAULT '0' auto_increment, > customerId int(11) NOT NULL DEFAULT '0' , > 020A char(10) NOT NULL DEFAULT '' , > orderPrice decimal(20,4) NOT NULL DEFAULT '0.0000' , > orderQty smallint(6) NOT NULL DEFAULT '0' , > orderSource tinyint(3) unsigned NOT NULL DEFAULT '0' , > 245A char(50) , > 100A char(50) , > 260B char(50) NOT NULL DEFAULT '' , > GroupID int(11) NOT NULL DEFAULT '0' , > PRIMARY KEY (customerId,020A), > KEY sequence (sequence), > KEY customerId (customerId), > KEY 020A (020A), > KEY GroupID (GroupID) > ); > > > Greg Lawrie > > C i m t e c h > 51 Byron Place > Adelaide South Australia 5000 > Phone +618 8212 8799 Fax +618 8212 8766 > Email [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > > ------------------------------------------------------------------------ > -- > Computer Sales :: Network Design and Installation > Software Development :: Database Design > ------------------------------------------------------------------------ > -- > > The information contained in this e-mail message may be > confidential. If you are not the intended recipient any use, > distribution, disclosure or copying of this information is > prohibited. If you receive this e-mail in error, please tell us > by return e-mail or phone 08 8212 8799 and delete it and any attachments > from your system. > > > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail > <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php ================================================================== 新浪免費電子信箱 http://sinamail.sina.com.hk --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php