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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2000-10-18 : 19:16:37
|
Barry L writes "I'm having trouble with nesting a subquery within another.
The subquery returns two records itself and that is used as the where clause of the main query which should return six matches.
As it is, I get an error ("... will return at most one record ...") but if I use the actual values returned by the subquery, IT WORKS!
SELECT Medicine.TradeName, Pharmacy.Name, Pharmacy.Address, Pharmacy.PhoneNo FROM Pharmacy INNER JOIN (Medicine INNER JOIN Sell ON Medicine.TradeName = Sell.TradeName) ON Pharmacy.Name = Sell.PName
WHERE (SELECT Medicine.TradeName FROM Pharmacy INNER JOIN (Medicine INNER JOIN Sell ON (Medicine.TradeName = Sell.TradeName)) ON (Pharmacy.Name = Sell.PName) WHERE (((Pharmacy.Name)="natura") AND ((Medicine.Type)="antibiotic")));
surely there must be a neater way to write this....
Barry L" |
|
|
|
|
|