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 |
|
Phi
Starting Member
2 Posts |
Posted - 2004-05-26 : 04:22:13
|
| Hi,Today I got a request to see if it's possible to join 2 columns together and base my ORDER BY upon that.This is what I have, working fine:CREATE VIEW user.viewASSELECT TOP 3 Id, Naam, Host, Woonplaats, IdAbon, WidthH, HeightH, YesCountFROM user.tableWHERE (IdAbon = 3) AND (Foto = 1)ORDER BY YesCountPoint is now, to sort the list on a combined value of YesCount & DatumDatum is a date value, off course, and YesCount is an integer.When I do this:CREATE VIEW user.viewASSELECT TOP 3 Id, Naam, Host, Woonplaats, IdAbon, WidthH, HeightH, YesCount, DatumFROM user.tableWHERE (IdAbon = 3) AND (Foto = 1)ORDER BY (YesCount+Datum)syntax check turns out succesfull, but I can't save the view.Error code: "Error 4511: Could not perform CREATE VIEW because no column name was specified for column 10."Which basically means, he wants the expression (YesCount+Datum) as a new column. How can I fix this?Or, any other suggestions on how to fix it?Thanx in Adv. |
|
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
Posted - 2004-05-26 : 04:29:15
|
I can suggest adding another column to the view:CREATE VIEW user.viewASSELECT TOP 3 Id, Naam, Host, Woonplaats, IdAbon, WidthH, HeightH, YesCount, Datum, (YesCount+Datum) as ordbyFROM user.tableWHERE (IdAbon = 3) AND (Foto = 1)ORDER BY (YesCount+Datum)will this be ok Duane. |
 |
|
|
Phi
Starting Member
2 Posts |
Posted - 2004-05-26 : 06:33:38
|
| WAUW!it worked (no errors), that's for sure.Now testing; see if it gives the results I want it to..Looks like it is going to work!MANY & GREAT THANX!Phi |
 |
|
|
|
|
|
|
|