February 23rd, 2012, 05:01 AM
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
Dynamic SQL Error.
SQL error code = -104.
count of column list and variable list do not match."
looking forward for your help
February 23rd, 2012, 05:25 AM
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