Link to home
Start Free TrialLog in
Avatar of Panos
PanosFlag for Germany

asked on

Replace In the output query with values from another table

Hello experts.
In the code below i want to replace the extras values with the values Extra_text from the Extras_All table
but i need only the first 2 separated with (, ) and if there are more than 2 i want to display in the end (....) to show that there are more than 2.
For in formation about the queries take a look at this question:
https://www.experts-exchange.com/questions/23848316/Problem-in-recordcount-with-group-function.html
Any help?
ArtExtras:
Artikel_ID        Extras                                
 2                     10
 2                     20
 2                     30                    
 5                     20
 5                     30
 
 a second
Extras_All :    
Extras_ID       Extras_Text                                
10                   text1
20                   text2
30                   text3
A third artikel
art_ID      Price  
2             10
5             15
In the above tables artikel.art_ID=ArtExtras.Artikel_ID
    and             Extras_all.Extras_ID=ArtExtras.Extras
    
<cfoutput query="dboartikel" group="#url.tfm_orderby#" startRow="#StartRow_dboartikel#" maxRows="#MaxRows_dboartikel#">
<cfoutput group="extras">
#price#
  <cfif #Extras# NEQ "">
   #extras#,</cfif>
 </cfoutput>
 </cfoutput>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of duncancumming
duncancumming
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Panos

ASKER

Hi duncancumming.
Thank you for your help.
Here is one more question that has to do with this one so that you can have more details:
https://www.experts-exchange.com/questions/23855306/Problem-in-recordcount-with-group.html

The first mistake is that i have FROM artikel a.It must appending your code FROM Extras_ALL.
Now i try to use your code in this example page but i have error
Column A.Art_ID is invalid in theselect list because it is noy contained in either an aggregate function or the group by close.
Avatar of Panos

ASKER

Sorry for the error.
I did a mistace.
Now the code is giving results but it is not working good
Avatar of Panos

ASKER

tHANK YOU
REGARDS
PANOS