You are here: How can I do amalgamate 3 select queries and then get unique entries from the result « MsSQL Server « IT news, forums, messages
How can I do amalgamate 3 select queries and then get unique entries from the result

Posted by Astra on 03/07/06 16:08

Hi All

Strange request I know, but could somebody give me pointers on how I can put
3 queries into 1 'thing' and then get only the unique entries from this
'thing'.

To explain, I'm using Excel/VBA/ODBC to query an SQL DB. The 3 queries
themselves aren't that complex and all return the same 2 fieldsets of stock
code and stock desc. Because these separate queries might bring back the
same stock code/description I need to amalgamate the data and then query
again to bring out only distinct stock values, eg:

Query 1 brings back:

stock code stock desc
IVP Invoice Paper
STP Statement Paper
KGC Keyboard Cover
etc... etc...

Query 2 brings back:

stock code stock desc
IVP Invoice Paper
BOB Back Pack
KGC Keyboard Cover
etc... etc...

Query 3 brings back:

stock code stock desc
KGC Keyboard Cover
3.5"D 3.5" Disks
etc... etc...

I need to produce 1 resultset that shows:
stock code stock desc
IVP Invoice Paper
BOB Back Pack
3.5"D 3.5" Disks
KGC Keyboard Cover
STP Statement Paper
etc... etc...
(all unique entries)

I'm currently just bringing back the 3 query results in Excel, but I'd like
to be able to do the above.

In light of I'm using Excel/VBA/ODBC on a PC, is it possible to do?

Thanks

Robbie

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация