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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 multiple tables

Author  Topic 

tkgb606
Starting Member

1 Post

Posted - 2002-04-15 : 21:37:12
I'm building an web based database, for some school org's each org has been assigned an unique id. there are two tables i need info from but not at the same time, the org is chosen and filtered by a url parameter, I can pull from one table but when write the SQl statement to pull from both tables no info comes up. This is the sintax i have so far
SELECT *
FROM TblMen , TblWomen
WHERE TblMen.[Chapter-Code]=TblWomen.[Chapter-Code] = 'MMColParam' AND (TblMen.Status=TblWomen.Status) BETWEEN '0' AND '1'
ORDER BY (TblMen.Status=TblWomen.Status)

dsdeming

479 Posts

Posted - 2002-04-15 : 23:00:16
In you where clause you can't say:

TblMen.[Chapter-Code]=TblWomen.[Chapter-Code] = 'MMColParam'

The first part is a join condition and the second is a filter.

Try something like this:

SELECT TblMen.*, TblWomen.*
FROM TblMen
JOIN TblWomen ON TblMen.[Chapter-Code]=TblWomen.[Chapter-Code] AND TblMen.Status=TblWomen.Status
WHERE TblMen.[Chapter-Code] = 'MMColParam' AND TblMen.Status BETWEEN '0' AND '1'
ORDER BY TblMen.Status




Go to Top of Page
   

- Advertisement -