Hello,
I am newbie to sql and i want your help.
I have a table valued function on my database with name CSPHPositionForDate_fn. The function needs 3 parameters..one for customer i search for , and 2 parameters for the date that i want to find data of this customer. The function working perfectly if i run the following code:
SELECT
ISNULL (SUM(PHD.Qty * PHD.PriceT),0)
FROM clroot.CSPHPositionForDate_fn('GΑLLΜΑRC', '2017-12-31 00:00:00', '2017-12-31 00:00:00', 0) PHD.
This Code returns 1 line and 1 column with the result of QTY* PriceT. for customer GΑLLΜΑRC ( example 53.4440000 )
My problem / question is that i have about 6.000 customers that i want to run this function. The customers names is like ( GΕΟRGΕΟC, GΕΟRΡΗΙS, LΙRΑGΕΟΙ, LΙRΑΜΟΝG, WΕΒSSΤΕΗ ......) and i want to run it for the same date for example '2017-12-31 00:00:00'.
So...how to run all this 6.000 names in the function and return 1 column with 6.000 lines with the results of all customers ?
FYI : I have the ability to get the customers names with filters on a select query, on one of my db tables.
I appreciate you for your time and your help.
best regards
Hercules Tsetsos