473,487 Members | 2,452 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

correct row ID but not the text

JRBower
14 New Member
I'm having trouble displaying text for 'Nationality' in a table. I can display the correct row ID (using the below SQL) but not the text. I'm sure I'm overlooking something simple:

Here's my SQL code:

Expand|Select|Wrap|Line Numbers
  1. SELECT    Recruiters.RecruiterID, Recruiters.FirstName, Recruiters.LastName, JobTitles.JobTitle, Recruiters.City, States.State, Countries.Country, Recruiters.Nationality
  2. FROM      dbo.Recruiters, dbo.JobTitles, dbo.States, dbo.Countries 
  3. WHERE     dbo.Recruiters.JobTitleID = dbo.JobTitles.JobTitleID
  4.   AND     dbo.Recruiters.StateID = dbo.States.StateID
  5.   AND     dbo.Recruiters.CountryID = dbo.Countries.CountryID
And here are my look up tables:

Expand|Select|Wrap|Line Numbers
  1. SELECT    StateID, State
  2. FROM      dbo.States
  3.  
  4. SELECT    CountryID, Country
  5. FROM      dbo.Countries 
  6.  
  7. SELECT    CountryID, Nationality
  8. FROM      dbo.Countries 
If I try adding:
Expand|Select|Wrap|Line Numbers
  1. AND     dbo.Recruiters.Nationality = dbo.Countries.Nationality
I get an error.

As you can see my countries table has Countries in one column and Nationalities in another. I'd rather not have to make a separate look up table for nationalities if possible.

Thanks for your help.

James
Jan 15 '08 #1
4 1498
ck9663
2,878 Recognized Expert Specialist
I'm having trouble displaying text for 'Nationality' in a table. I can display the correct row ID (using the below SQL) but not the text. I'm sure I'm overlooking something simple:

Here's my SQL code:

Expand|Select|Wrap|Line Numbers
  1. SELECT    Recruiters.RecruiterID, Recruiters.FirstName, Recruiters.LastName, JobTitles.JobTitle, Recruiters.City, States.State, Countries.Country, Recruiters.Nationality
  2. FROM      dbo.Recruiters, dbo.JobTitles, dbo.States, dbo.Countries 
  3. WHERE     dbo.Recruiters.JobTitleID = dbo.JobTitles.JobTitleID
  4.   AND     dbo.Recruiters.StateID = dbo.States.StateID
  5.   AND     dbo.Recruiters.CountryID = dbo.Countries.CountryID
  6.  
And here are my look up tables:

Expand|Select|Wrap|Line Numbers
  1. SELECT    StateID, State
  2. FROM      dbo.States
  3.  
  4. SELECT    CountryID, Country
  5. FROM      dbo.Countries 
  6.  
  7. SELECT    CountryID, Nationality
  8. FROM      dbo.Countries 
If I try adding:
Expand|Select|Wrap|Line Numbers
  1. AND     dbo.Recruiters.Nationality = dbo.Countries.Nationality
I get an error.

As you can see my countries table has Countries in one column and Nationalities in another. I'd rather not have to make a separate look up table for nationalities if possible.

Thanks for your help.

James
by the looks of this, your Nationality field is in the Countries table, not in Recruiters.your code (Recruiters.Nationality) will give you an error.

try:
Expand|Select|Wrap|Line Numbers
  1. SELECT    Recruiters.RecruiterID, Recruiters.FirstName, Recruiters.LastName, JobTitles.JobTitle, Recruiters.City, States.State, Countries.Country, Cou ntries.Nationality
  2. FROM      dbo.Recruiters, dbo.JobTitles, dbo.States, dbo.Countries 
  3. WHERE     dbo.Recruiters.JobTitleID = dbo.JobTitles.JobTitleID
  4.   AND     dbo.Recruiters.StateID = dbo.States.StateID
  5.   AND     dbo.Recruiters.CountryID = dbo.Countries.CountryID

-- CK
Jan 15 '08 #2
JRBower
14 New Member
by the looks of this, your Nationality field is in the Countries table, not in Recruiters.your code (Recruiters.Nationality) will give you an error.

try:
Expand|Select|Wrap|Line Numbers
  1. SELECT    Recruiters.RecruiterID, Recruiters.FirstName, Recruiters.LastName, JobTitles.JobTitle, Recruiters.City, States.State, Countries.Country, Countries.Nationality
  2. FROM      dbo.Recruiters, dbo.JobTitles, dbo.States, dbo.Countries 
  3. WHERE     dbo.Recruiters.JobTitleID = dbo.JobTitles.JobTitleID
  4.   AND     dbo.Recruiters.StateID = dbo.States.StateID
  5.   AND     dbo.Recruiters.CountryID = dbo.Countries.CountryID

-- CK
Thanks for your assistance CK. Actually my original code was as you suggested (Countries.Nationality) but for some reason it's not producing the right nationality. When I changed it to Recruiters.Nationality the correct row was selected but only the ID number would dislplay. What seems intuitive to me (and follows the same logic as
Expand|Select|Wrap|Line Numbers
  1. AND     dbo.Recruiters.CountryID = dbo.Countries.CountryID
is to add:

Expand|Select|Wrap|Line Numbers
  1. AND     dbo.Recruiters.Nationality = dbo.Countries.Nationality
since I have a Nationality column (int) in my Recruiters table. However, when I execute the code it throws an error.

Is there another approach to solving this problem?

Thanks again,
James
Jan 16 '08 #3
ck9663
2,878 Recognized Expert Specialist
Thanks for your assistance CK. Actually my original code was as you suggested (Countries.Nationality) but for some reason it's not producing the right nationality. When I changed it to Recruiters.Nationality the correct row was selected but only the ID number would dislplay. What seems intuitive to me (and follows the same logic as
Expand|Select|Wrap|Line Numbers
  1. AND     dbo.Recruiters.CountryID = dbo.Countries.CountryID
is to add:

Expand|Select|Wrap|Line Numbers
  1. AND     dbo.Recruiters.Nationality = dbo.Countries.Nationality
since I have a Nationality column (int) in my Recruiters table. However, when I execute the code it throws an error.

Is there another approach to solving this problem?

Thanks again,
James

would you mind posting here the code that you have that shows the ID and post the other code that give you an error and also the error that you're seeing...


-- CK
Jan 16 '08 #4
JRBower
14 New Member
would you mind posting here the code that you have that shows the ID and post the other code that give you an error and also the error that you're seeing...


-- CK
Hi CK,
Thanks for your attention. I decided to just make another lookup table which solved the problem.

Cheers,
James
Jan 16 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
3001
by: David Opstad | last post by:
I have a question about text rendering I'm hoping someone here can answer. Is there a way of doing linguistically correct rendering of Unicode strings in Python? In simple cases like Latin or...
0
2138
by: Philip Meyer | last post by:
1) setting image as Background with alignment in center not working..help Explanation : i need to set a image as background and also it should be dispalyed in the center.i am using apache fop...
0
1005
by: ST | last post by:
Hello, I will be posting 2 errors that I just can't seem to figure out (I'll put them in different posts). I have looked all over the internet, and I still can't figure these out! This webapp was...
7
5278
by: Esteban404 | last post by:
I've tried many conversions to get the values to be accepted, but none are working and the subject error message is returned for Parse and ToInt32. I haven't figured out what "format" is wrong. I'm...
50
5990
by: Shadow Lynx | last post by:
Consider this simple HTML: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 STRICT//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head>...
27
2805
by: pamela fluente | last post by:
Hello, for the following code, VS suggests that construct (width= height= ) is out of date and a newer one is recommended: <table><tr><td width="92" height="38" valign="middle">AnyThing</td></...
1
2557
by: kang jia | last post by:
hi currently i am editing signup page, when user enter deupicated NRIC and click signup, they will go to do_signuppage and read the error message and then after 5 seconds, they will be redirected...
1
3206
by: kang jia | last post by:
hi when user entered particulars in signuppage and click" signup" button, i will direct them to do_signup.php. if say the NRIC is dupicate in datebase, i will redirect them back to signup page...
1
1373
by: Anthony Planz | last post by:
Hello, I have a problem with displaying Greek fonts in a content placeholder. The Masterpage content displays correct, the content inside the content placeholder not. Example:...
1
4727
by: differentsri | last post by:
THIS IS AN ASP.NET 1.1 APPLICATION IAM TRYING TO UPDATE THE FIELD BUT I AM NOT ABLE TO UPDATE IT? CAN U TELL THE REASON ? IT IS GIVING THE FOLLOWING ERROR BELOW I HAVE ALSO GIVEN THE CODE OF...
0
6967
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7137
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7349
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5442
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3076
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1381
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
600
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.