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 |
|
siasfouche
Starting Member
5 Posts |
Posted - 2008-04-16 : 03:42:16
|
| I have table HITS with columns ID and hitDate and table DATESS with columns startDate and endDate.I can have alot of entries in the HITS table with hitDate between the times of a startDate and endDate entry in the DATESS table.What I am trying to do is to select all the ID's of the entries where hitDate is between startDate and endDate. (In the end I would use min and max to get the firt and last hit between those times)I have tried:SELECT ID from hits,Datess WHERE hitdate between startDate and endDate but it does not give the required results. I think the problem is the tables are not related in any way. Is there another way to do this.Thanks |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-16 : 03:47:45
|
| SELECT IDFROM HITS hCROSS JOIN DATESS dWHERE h.hitdate BETWEEN d.startDate and sd.endDate |
 |
|
|
siasfouche
Starting Member
5 Posts |
Posted - 2008-04-16 : 05:01:40
|
| Thanks |
 |
|
|
|
|
|