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 |
fm88
Starting Member
18 Posts |
Posted - 2008-09-02 : 03:03:32
|
How can i select the max memberid from a tblMembers,and then add this id with serviceID in another table tblMemberServ in the same query? |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-09-02 : 03:23:38
|
What do you mean by "Add this id with ServiceID"? E 12°55'05.63"N 56°04'39.26" |
 |
|
fm88
Starting Member
18 Posts |
Posted - 2008-09-02 : 03:31:52
|
I mean take Max(MemberId) from tblMembers,and then add in another table tblMemberServ(2 columns memberId,ServID) the Max(memberId),ServiceID...is it possible in one query? |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-09-02 : 04:25:46
|
Still not clear what you want.INSERT TargetTable ( TargetCol1, TargetCol2 )SELECT MAX(SourceCol1), 'SomeData'FROM SourceTableUPDATE TargetTableSET TargetCol1 = (SELECT MAX(SourceCol1) FROM SourceTable)WHERE TargetCol2 = 'SomeData' E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|
|