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 |
amonteiro
Starting Member
2 Posts |
Posted - 2005-01-19 : 19:24:12
|
This is my query(SELECT top 10 blogData.blog, blogData.ID, blogData.img, blogData.imgLink, blogData.title, blogData.date_in, blogData.quote, blogData.link, blogData.linkText, blogData.additionalCode, blogData.author, blogData.Category, blogData.broken, Categories.CatID as CatID, Categories.Category as BlogCategory FROM blogData INNER JOIN Categories ON blogData.Category = Categories.CatID where id >= 532 order by date_in asc) union (SELECT top 10 blogData.blog, blogData.ID, blogData.img, blogData.imgLink, blogData.title, blogData.date_in, blogData.quote, blogData.link, blogData.linkText, blogData.additionalCode, blogData.author, blogData.Category, blogData.broken, Categories.CatID as CatID, Categories.Category as BlogCategory FROM blogData INNER JOIN Categories ON blogData.Category = Categories.CatID where id <= 532 order by date_in desc) order by date_in descMy problem is that the blog field that comes back comes back as a 255 character field, I assume string. When in the table it is a memo field , so information is lost. Any ideas would be greatly appreciated. Thanks a lot. |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2005-01-19 : 21:21:55
|
just return primary keys in your union query, and then join the results of the union to any other tables in which you need to return data (such as memo fields).- Jeff |
 |
|
amonteiro
Starting Member
2 Posts |
Posted - 2005-01-19 : 23:13:21
|
Thanks a lot, I should have thought of that. Probably not the most effecient way but good enough |
 |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2005-01-20 : 07:03:08
|
Actually, that IS the most efficient way. and use UNION ALL, also -- even more efficient.- Jeff |
 |
|
|
|
|
|
|