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 |
peace
Constraint Violating Yak Guru
420 Posts |
Posted - 2012-03-23 : 00:28:26
|
How can i update with inner join and where claus?
want to update passenger table to update the exact country. As in the View table I cant update.
View passenger table: ID Name PNumber Country 1 Jane 12345 JP
Passenger table: ID Name PNumber 1 Jane 12345
COuntry table: ID Country 1U US
Contact table: ID Name Pnumber 1 Jane 1234 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-03-23 : 00:40:21
|
howzz country table related to other tables?
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
peace
Constraint Violating Yak Guru
420 Posts |
Posted - 2012-03-23 : 00:44:01
|
In my View table there is Country
View passenger table: ID Name PNumber Country 1 Jane 12345 JP
But i cannot update View table |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-03-23 : 00:47:49
|
so does JP correspond to ID field in Country table?
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
peace
Constraint Violating Yak Guru
420 Posts |
Posted - 2012-03-23 : 00:56:14
|
If i select will be like this :
SELECT A.Id, C.emailaddress1, C.firstname, [Country].Aa_shortcode
FROM A
INNER JOIN B ON C.Id = B.Id
LEFT JOIN countryDetails[Country] ON [Country].countryId = B.addresscountryid
WHERE emailaddress1 in ('abc@c.com') |
 |
|
peace
Constraint Violating Yak Guru
420 Posts |
Posted - 2012-03-23 : 01:00:56
|
Would like to update this guest country ('abc@c.com')
From JP to US |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-03-23 : 01:21:19
|
your explanation doesnt make any sense. post proper data and explain your problem...otherwise we wont be able to help...
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
sarathy
Starting Member
2 Posts |
Posted - 2012-03-23 : 11:54:07
|
Hi Used this query for Inner join with using where condition, you get answer
select * from table 1 NF inner join table2 NP on nf.ID=np.ID inner join table3 NC on nf.ID= NC.ID where NF.Pnumbaer=12345
S.Partahasarthy |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-03-23 : 19:56:52
|
wont work as per posted data as ID value is not same in Country table
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
|
|
|