1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2011
    Rep Power

    Need Help in sql query

    Iam using firebird database and i want to create a query like this

    select Sid,sname,(select d_id,d_address from tbl1) from tbl2

    Multiple select in an inner query but ib expert returns error like this

    "Invalid token.
    Dynamic SQL Error.
    SQL error code = -104.
    Invalid command.
    count of column list and variable list do not match."

    looking forward for your help

  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2006
    Plovdiv. Bulgaria
    Rep Power
    You can't use nested selects that return more than one column and more than one result per row if they are in SELECT's "area".
    In your case for every row from tbl2 you want to return all rows from tbl1. Try to join them with some condition or change the select. If you really want to get all rows from tbl1 for every record in tbl2:
    select tbl2.Sid,tbl2.sname, tbl1.d_id, tbl1.d_address from tbl2,tbl1

IMN logo majestic logo threadwatch logo seochat tools logo