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 2307
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: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
| |