By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,890 Members | 1,039 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,890 IT Pros & Developers. It's quick & easy.

insert...select

P: 9
this gives me error message: Subquery returns more than 1 row

"INSERT INTO customerbook (booking_ID,room_Type)
values((select booking_ID from bookings where booking_ID = bookings.booking_ID),'$a')"

any solution?
Apr 30 '07 #1
Share this Question
Share on Google+
1 Reply


cyberking
P: 84
this gives me error message: Subquery returns more than 1 row

"INSERT INTO customerbook (booking_ID,room_Type)
values((select booking_ID from bookings where booking_ID = bookings.booking_ID),'$a')"

any solution?
Hi!
OMG. Your query seems like a riddle to me, I mean bookings.bookin_id where booking_id=booking.booking_id. lol, dont you think it rhymes sort of..

Anyways, yes. What is happening here is your subquery which is
select booking_ID from bookings where booking_ID = bookings.booking_ID
returns more than one selection. Thereby the error subquery returns more than one value. That is your query results in more than one match for your condition
where booking_ID = bookings.booking_ID .

Try ifinding out your subquery result
$query = select booking_ID from bookings where booking_ID = bookings.booking_ID
$result = mysql_query($query);
$ans = mysql_fecth_assoc($resullt);

Try echoin the values and you ll know whats goin wron

Regards
CyberKing
www.bytesandbytes.com
May 1 '07 #2

Post your reply

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