Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Mondeo
Constraint Violating Yak Guru
287 Posts |
Posted - 2010-08-06 : 08:22:02
|
Hi,I have this SP@capid int SELECT(select A.vehicleref, F.CH FROM dbPubMatrix..tblNewMatrixArval A INNER JOIN dbPubMatrix..tblNewMatrixFigures F ON A.vehicleref = F.vehicleref WHERE A.CAPID = @capid and F.maintained=0 and F.MilesPA=10000 and F.Term =3),(select A.vehicleref, F.CH FROM dbPubMatrix..tblNewMatrixAld A INNER JOIN dbPubMatrix..tblNewMatrixFigures F ON A.vehicleref = F.vehicleref WHERE A.CAPID = @capid and F.maintained=0 and F.MilesPA=10000 and F.Term =3)It's giving this errorOnly one expression can be specified in the select list when the subquery is not introduced with EXISTS.Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.How can I fix it?Thanks |
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2010-08-06 : 08:42:11
|
This maybe? ->select A.vehicleref, F.CH FROM dbPubMatrix..tblNewMatrixArval A INNER JOIN dbPubMatrix..tblNewMatrixFigures F ON A.vehicleref = F.vehicleref WHERE A.CAPID = @capid and F.maintained=0 and F.MilesPA=10000 and F.Term =3UNION ALLselect A.vehicleref, F.CH FROM dbPubMatrix..tblNewMatrixAld A INNER JOIN dbPubMatrix..tblNewMatrixFigures F ON A.vehicleref = F.vehicleref WHERE A.CAPID = @capid and F.maintained=0 and F.MilesPA=10000 and F.Term =3 - LumbagoMy blog (yes, I have a blog now! just not that much content yet) -> www.thefirstsql.com |
 |
|
|
|
|