| Author |
Topic |
|
Reez
Starting Member
3 Posts |
Posted - 2008-11-12 : 02:20:06
|
| Hey,Iam using access but writing the codes through tthe SQL view.I have 2 tables one: Antenna(AntID,AntTypeID) and another table AntennaType(AntTypeID,AntTypeName)In the Relations Section Iconnected AntTypeID both together. I want to create a query to display (AntID,AntTypeName)what's the SELECT statement I should use? I tried this but it didn't work:SELECT Antenna.AntID,AntennaType.AntTypeNameFROM Antenna, AntennaTypethank you |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-12 : 02:21:46
|
| do you need access query or sql query? |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-11-12 : 02:27:26
|
You have to relate the to tables.SELECT *FROM Antenna AS aINNER JOIN AntennaType AS t ON t.AntTypeID = a.AntTypeID E 12°55'05.63"N 56°04'39.26" |
 |
|
|
Reez
Starting Member
3 Posts |
Posted - 2008-11-12 : 02:36:02
|
| I want an access query.I tried this codeSELECT AntID, AntTypeNameFROM AntType INNER JOIN Antenna ON AntennaTypeSpecs.AntTypeID = Antenna.AntTypeID;It worked, but the query showed me the AntID 1,2,3,4,7 and skipped 5, 6. Why? |
 |
|
|
lionofdezert
Aged Yak Warrior
885 Posts |
Posted - 2008-11-12 : 03:05:41
|
| Do you have data in AntType Table against AntID 5 and 6 (AntTypeId in Anteena table against AntId 5 and 6 should be present in AntType table). Inner join will return only results that qualify the join condition. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-11-12 : 03:18:09
|
SELECT *FROM AntennaType AS tLEFT JOIN Antenna AS a ON a.AntTypeID = t.AntTypeID E 12°55'05.63"N 56°04'39.26" |
 |
|
|
Reez
Starting Member
3 Posts |
Posted - 2008-11-12 : 03:37:10
|
| Yes, the data is properly filled and there are no Null fields, I don't know why, and by the way, I created another query, and the next time, the number 3 didn't appear, and I hadn't changed anything.weird. |
 |
|
|
Nageswar9
Aged Yak Warrior
600 Posts |
Posted - 2008-11-17 : 06:25:04
|
| SELECT AntID,AntTypeNameFROM Antenna AS aINNER JOIN AntennaType AS at (at.AntTypeID = a.AntTypeID)I Struggle For Excellence |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-11-17 : 07:22:34
|
quote: Originally posted by Nageswar9 SELECT AntID,AntTypeNameFROM Antenna AS aINNER JOIN AntennaType AS at (at.AntTypeID = a.AntTypeID)I Struggle For Excellence
This is Peso's first replyMadhivananFailing to plan is Planning to fail |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-17 : 09:35:17
|
quote: Originally posted by madhivanan
quote: Originally posted by Nageswar9 SELECT AntID,AntTypeNameFROM Antenna AS aINNER JOIN AntennaType AS at (at.AntTypeID = a.AntTypeID)I Struggle For Excellence
This is Peso's first replyMadhivananFailing to plan is Planning to fail
seems like he's not at all reading earlier posts before replying |
 |
|
|
|