Anybody
I have two tables like so:
Employee:
Employee_ID Name
------------------------------------------
01 Hansen, Ola
02 Svendson, Tove
03 Svendson, Stephen
04 Pettersen, Kari
Orders:
Prod_ID Product Employee_ID
-----------------------------------------------------
234 Printer 01
657 Table 03
865 Chair 03
I want to create an SQL statement that will return the following result
Name ProductList
-----------------------------------------------------
Hansen, Ola Printer
Svendson, Tove
Svendson, Stephen Table, Chair
Pettersen, Kari
Basically, I want to return a new column with a list of all the orders.
How
would I achieve this?
John 2 2309
John wrote: Anybody
I have two tables like so:
Employee:
Employee_ID Name ------------------------------------------ 01 Hansen, Ola 02 Svendson, Tove 03 Svendson, Stephen 04 Pettersen, Kari
Orders:
Prod_ID Product Employee_ID ----------------------------------------------------- 234 Printer 01 657 Table 03 865 Chair 03
I want to create an SQL statement that will return the following result
Name ProductList ----------------------------------------------------- Hansen, Ola Printer Svendson, Tove Svendson, Stephen Table, Chair Pettersen, Kari
Basically, I want to return a new column with a list of all the orders. How would I achieve this?
John
Googling reveals numerous pages that explain verbatim how to do 95% of
what you ask. I suspect the remainder (one record per employee with a
comma separated list of products) will need to be done with VBA. To
start I would consider walking through any recordsets where
COUNT(EmpName) > 1 and concatenate the Product values.
--
Smartin
John wrote in message <12*************@corp.supernews.com> : Anybody
I have two tables like so:
Employee:
Employee_ID Name ------------------------------------------ 01 Hansen, Ola 02 Svendson, Tove 03 Svendson, Stephen 04 Pettersen, Kari
Orders:
Prod_ID Product Employee_ID ----------------------------------------------------- 234 Printer 01 657 Table 03 865 Chair 03
I want to create an SQL statement that will return the following result
Name ProductList ----------------------------------------------------- Hansen, Ola Printer Svendson, Tove Svendson, Stephen Table, Chair Pettersen, Kari
Basically, I want to return a new column with a list of all the orders. How would I achieve this?
John
I think you'll need more than just SQL, I think you'll need to call a
VBA function, too.
Check out Duane Hookoms "Generic Function To Concatenate Child Records" http://www.rogersaccesslibrary.com/OtherLibraries.asp
--
Roy-Vidar This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Hugh Macdonald |
last post by:
I'm calling a command from within a python script and I need to be
able to both catch the output (stdout and stderr) from it and also
have the PID (so that I can kill it)
I can do one or other...
|
by: Rhino |
last post by:
I am having an odd problem: the sqlj command on my system doesn't work.
I am running DB2 (LUW) V8 (FP8) on WinXP.
I haven't done an sqlj program since Version 6 of DB2 (LUW) so I checked the...
|
by: Lucas Cowald |
last post by:
Hi,
I need to RUN/execute a Command-Line command from an ASP page.
This is the command:
sse45.exe -i k:\o\2.wmv -o k:\o\2.shh -w 128 -df 0 -m 2 -p
Can you show me a code how to run this...
|
by: paul |
last post by:
I have a file type that is going to be associated with my
visual basic application and i want the user to be able
to double click on a file of said type and have it launch
the program and load the...
|
by: Roman Mashak |
last post by:
Hello, All!
I'm implementing simple CLI (flat model, no tree-style menu etc.). Command
line looks like this: <command> <param1> <param2> ... <paramN> (where
N=1..4)
And idea is pretty simple:
...
|
by: clsmith66 |
last post by:
I've been asked to find out if a project is possible, but I'm not having much
luck finding the information I need, I hope some one can help. I need to see
if I can build a windows service on the...
|
by: John Salerno |
last post by:
Here's my new project: I want to write a little script that I can type
at the terminal like this:
$ scriptname package1
where scriptname is my module name and any subsequent arguments are the...
|
by: jimmy |
last post by:
Hi again,
sorry for posting two questions so close together but im working on a
school project which is due in soon and running into some difficulties
implementing the database parts. I have the...
|
by: Ojas |
last post by:
Hi!,
I just out of curiosity want to know how top detect the client side
application under which the script is getting run. I mean to ask the
how to know whether the script is running under...
|
by: Jwe |
last post by:
Hi,
I've written a program which has both a command line interface
and Windows form interface, however it isn't quite working
correctly.
When run from command line with no arguments it should...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |