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 |
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2005-01-28 : 02:43:54
|
| I have a main table of entriesI have a separate table listing areasNow I have a link table with the entry id and area id (as each entry has more then one area)How can I run a query searching all the entries for a specific area?what is my relationships on those 3 tables?Am I going about this in the wrong way? |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2005-01-28 : 02:50:18
|
| select e.*from entries ejoin entry_area aeon e.entry_id = ae.entry_idjoin area aon a area_id = ae.entrty_idwhere a.name = @myarea==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2005-01-28 : 03:15:35
|
| select fp.*from fundprograms fpjoin fundarealinks aeon fp.id = ae.fundprogramidjoin areaofinterest aon a id = ae.areaofinterestidthe above is returning an errorlet me give you the complete structure as I am doing something wrong4 tables1. fundprograms - id,geographyid,name,deadline,comments2. fundareallinks - id,areaofinterestid,fundprogramid3. areasofinterst - id, areaeng4. geographic-- id, geoI will need to do a complete query querying based on areaofinterst,deadline, and geographicidCan you help me? |
 |
|
|
polygonSQL
Starting Member
8 Posts |
Posted - 2005-01-28 : 06:17:41
|
| I am going to assume that the "id" in each table are supposed to match upselect *from fundprograms FPinner join fundarealinks FL on FP.id = FL.idinner join areaofinterest AI on FP.id = AI.idselect * from end_userwhere clue > 0GO( 0 rows returned ) |
 |
|
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2005-01-28 : 06:43:11
|
| fundarealinks has a fundprogramid and areaofinterestid meant to combine the two tables fundprograms and areaofinterestI tried select *from fundprograms FPinner join fundarealinks FL on FP.id = FL.fundprogramidinner join areaofinterest AI on FL.areofinterestid = AI.idbut it is still giving me an syntax error. (This is in access) |
 |
|
|
polygonSQL
Starting Member
8 Posts |
Posted - 2005-01-28 : 06:56:33
|
| I don't know anything about acess sorry.select * from end_userwhere clue > 0GO( 0 rows returned ) |
 |
|
|
|
|
|