Sub query returns more than 1 row

255
June 18, 2017, at 6:40 PM

My web site is a cafeteria, user login and ordering ... When the same user logs in twice, the sub query error appears. What are the possible ways to solve the sub query problem?

Answer 1

if your subquery return more then a row

you can use a in clause if your manage more rows

  select * from my_table
  where id in (select id from table2 where ....)

or obtain asingle result eg: using aggregation function

  select * from my_table
  where id = (select max(id) from table2 where ....)
Rent Charter Buses Company
READ ALSO
sort with SELECT drop down asc desc connecting to database

sort with SELECT drop down asc desc connecting to database

I am trying to create a drop-down list to display vehicles that are on "special" on my web browser that are from my databaseI would like them to display in price order of asc to desc

329
Find Count of racers from Race Table

Find Count of racers from Race Table

I am new to SQL,I have two tables RACER and SPONSOR, RACER TABLE has these columns

301
How to get the multiple images selected by the user in a form and display it in next page?

How to get the multiple images selected by the user in a form and display it in next page?

I have created a register page where user is asked to choose the 4 security images for him, along with other details

220