PDA

View Full Version : problem in update query



purnendu2311
04-28-2007, 09:03 AM
Hi.

i am to update the last record of my table. plz help me. i am using subquery for updating the last record.

This is mysql code i am using:

I am using the query to update::::

update paypal set title='Mr', fname='srikanthrrr', sname='ram', phone='34334343333', email='srikanth11@netvisionsolutions.com', dob='2/5/1980/', pd='srikantha', hno='Himayathnager', place='hyd', country='india', pcode='3443443434343333' where sno= (SELECT MAX(sno) FROM paypal);


This is my table structure:
CREATE TABLE `paypal` (
`sno` int(100) NOT NULL auto_increment,
`title` varchar(100) collate latin1_general_ci NOT NULL,
`fname` varchar(100) collate latin1_general_ci NOT NULL,
`sname` varchar(100) collate latin1_general_ci NOT NULL,
`phone` varchar(100) collate latin1_general_ci NOT NULL,
`mobile` varchar(200) collate latin1_general_ci NOT NULL,
`email` varchar(100) collate latin1_general_ci NOT NULL,
`dob` varchar(100) collate latin1_general_ci NOT NULL,
`pd` varchar(100) collate latin1_general_ci NOT NULL,
`hno` varchar(100) collate latin1_general_ci NOT NULL,
`place` varchar(100) collate latin1_general_ci NOT NULL,
`country` varchar(100) collate latin1_general_ci NOT NULL,
`pcode` varchar(100) collate latin1_general_ci NOT NULL,
`dos` varchar(100) collate latin1_general_ci NOT NULL,
`status` varchar(100) collate latin1_general_ci NOT NULL,
PRIMARY KEY (`sno`)
)



INSERT INTO `paypal` (`sno`, `title`, `fname`, `sname`, `phone`, `mobile`, `email`, `dob`, `pd`, `hno`, `place`, `country`, `pcode`, `dos`, `status`) VALUES (1, 'netvision', 'purnendu', 'raja', '9845784578', '', 'puru_singh2004@yahoo.co.in', '2007-04-30', 'aaaaaaaa', '3-6-457', 'hyderabad', 'India', '50025', '2007-04-30', 'active'),
(2, 'Infosis', 'Ranjan', 'ranja', '433444', '', 'a@a.com', '2007-04-30', 'aaaaaaa', '4-5-455', 'hyderabad', 'india', '200025', '2007-04-30', 'active'),
(8, '1', 'purnendu', '', '34334343', '', 'ranjan@netvision.com', '2/3/1989', '', 'dfdfdfdfd', 'dfdfff', 'dffdfdfd', '3443443434343', '', ''),
(7, '', '', '', '', '', '', '//', '', '', '', '', '', '', '$'),
(9, 'Mrs', 'sweeya', 'reddy', '040-45784578', '9845784578', 'sweey@netvisionsolutions.com', '1/1/1979', 'sweeya', 'fgfgggfgfg', 'Hyderabad', 'india', '12541245', '', ''),
(10, 'Dr', 'purnendu', '', '34334343', '', 'ranjan@netvision.com', '2/3/1989', '', 'Himayathnager', 'Hyderabad', 'India', '12541245', '', ''),
(11, 'Mrs', 'kavya', '', '34334343', '09347045052', 'kavya@netvisionsolutions.com', '4/5/1968', '', 'Himayathnager', 'Hyderabad', 'india', '12541245', '', ''),
(12, 'Mr', 'Ram', 'reddy', '34334343', '09347045052', 'rebbap@yahoo.com', '3/3/1988', 'reddy1', 'Himayathnager', 'Hyderabad', 'india', '3443443434343', '', ''),
(13, 'Mr', 'srikanth', 'reddy', '34334343', '09347045052', 'srikanth@netvisionsolutions.com', '2/5/1980', 'srikanth', 'Himayathnager', 'Hyderabad', 'india', '3443443434343', '', '');


Please help me. Its urgent.

Thanks & Regards

Ranjan

tomyknoker
04-30-2007, 12:07 PM
Sorry don't understand exactly what your saying the issue is... Is none of the info getting inserted into the database? Or is everything getting inputted into the db except for the last record
(13, 'Mr', 'srikanth', 'reddy', '34334343', '09347045052', 'srikanth@netvisionsolutions.com', '2/5/1980', 'srikanth', 'Himayathnager', 'Hyderabad', 'india', '3443443434343', '', '');?

Twey
04-30-2007, 12:20 PM
Ah, you've made the classic mistake of giving us lots of info, but not actually telling us the problem with it. As much as we enjoy looking at your table structure, we'd be much more productive if you were to let slip some sort of hint as to what exactly is going wrong.