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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-11-17 : 10:28:56
|
| Michael writes "I'm trying to write a SQL statement that rearranges the data. For example, let's say that the data looks something like this:firstNamelastName MichaelJones Tammy>Smith ShawnLaGrangeHow can I write a simple SQL statement that randomly rearranges the last name to another record? A sample output could look like this:firstNamelastName MichaelSmith TammyLaGrange ShawnJonesOriginally, record one had "Jones" as the last name, but now it is "Smith". How can I write a SQL statement that performs this function? I am using SQL Server 2000 on Windows 2003 with the latest service packs." |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2006-11-17 : 11:19:26
|
| This will match every first name with every last name, have fun.SELECT a.FirstName, b.LastNameFROM yourtable aCROSS JOIN yourtable b |
 |
|
|
|
|
|