Click here to Skip to main content
15,885,365 members
Home / Discussions / Database
   

Database

 
AnswerRe: SMO Retrieve Table Record Pin
Sandeep Mewara28-Jan-13 2:42
mveSandeep Mewara28-Jan-13 2:42 
AnswerRe: SMO Retrieve Table Record Pin
savbace28-Jan-13 2:55
savbace28-Jan-13 2:55 
QuestionRe: SMO Retrieve Table Record Pin
Eddy Vluggen28-Jan-13 3:21
professionalEddy Vluggen28-Jan-13 3:21 
AnswerRe: SMO Retrieve Table Record Pin
Sandeep Mewara28-Jan-13 3:22
mveSandeep Mewara28-Jan-13 3:22 
AnswerRe: SMO Retrieve Table Record Pin
savbace28-Jan-13 3:40
savbace28-Jan-13 3:40 
Questionhow can reporting in this Situation Pin
karimkpg26-Jan-13 2:38
karimkpg26-Jan-13 2:38 
AnswerRe: how can reporting in this Situation Pin
Sandeep Mewara26-Jan-13 6:02
mveSandeep Mewara26-Jan-13 6:02 
QuestionQuery to concatenate multiple rows based on sequence in results set Pin
Alex Lush24-Jan-13 22:43
Alex Lush24-Jan-13 22:43 
Morning All,

I am trying to produce a query for a report that concatenates data from multiple rows. Easiest if I explain what I have, and what I need to end up with! This is Sage Line 500 data by the way.

The table I am querying contains sale order lines as follows:

order_no  order_line_no	 line_type	product	   long_description
100001    1              P              47020      1st description for 47020
100001    2              C                         2nd line description for 47020
100001    3              P              47030      1st description for 47030
100001    4              C                         2nd line description for 47030
100001    5              P              47040      1st description for 47040
100001    6              C                         2nd line description for 47040
100001    7              P              47050      1st description for 47050
100001    8              C                         2nd line description for 47050
100001    9              C                         3rd line for 47050


So the lines with a line_type 'C' are a continuation line for the description. The problem is they are just numbered sequencially and there could be any number of them.

I want to end up with a results set something like this:

order_no  order_line_no	 line_type	product	   long_description
100001    1              P              47020      1st description for 47020 2nd line description for 47020
100001    3              P              47030      1st description for 47030 2nd line description for 47030
100001    5              P              47040      1st description for 47040 2nd line description for 47040
100001    7              P              47050      1st description for 47050 2nd line description for 47050 3rd line for 47050


Any help or pointers on where to start looking greatly apreciated.
Thanks,

Alex

AnswerRe: Query to concatenate multiple rows based on sequence in results set Pin
Eddy Vluggen25-Jan-13 1:51
professionalEddy Vluggen25-Jan-13 1:51 
AnswerRe: Query to concatenate multiple rows based on sequence in results set Pin
Shameel25-Jan-13 3:20
professionalShameel25-Jan-13 3:20 
GeneralRe: Query to concatenate multiple rows based on sequence in results set Pin
Alex Lush25-Jan-13 3:30
Alex Lush25-Jan-13 3:30 
AnswerRe: Query to concatenate multiple rows based on sequence in results set Pin
mmccarth25-Jan-13 5:21
mmccarth25-Jan-13 5:21 
QuestionSyntax error (Missing Operator) in Query expression ':0:1 Pin
IgaBaro23-Jan-13 14:40
IgaBaro23-Jan-13 14:40 
AnswerRe: Syntax error (Missing Operator) in Query expression ':0:1 Pin
Mycroft Holmes23-Jan-13 15:02
professionalMycroft Holmes23-Jan-13 15:02 
GeneralRe: Syntax error (Missing Operator) in Query expression ':0:1 Pin
IgaBaro23-Jan-13 15:25
IgaBaro23-Jan-13 15:25 
GeneralRe: Syntax error (Missing Operator) in Query expression ':0:1 Pin
PIEBALDconsult23-Jan-13 15:37
mvePIEBALDconsult23-Jan-13 15:37 
GeneralRe: Syntax error (Missing Operator) in Query expression ':0:1 Pin
IgaBaro23-Jan-13 16:16
IgaBaro23-Jan-13 16:16 
GeneralRe: Syntax error (Missing Operator) in Query expression ':0:1 Pin
PIEBALDconsult23-Jan-13 16:26
mvePIEBALDconsult23-Jan-13 16:26 
GeneralRe: Syntax error (Missing Operator) in Query expression ':0:1 Pin
IgaBaro23-Jan-13 16:58
IgaBaro23-Jan-13 16:58 
GeneralRe: Syntax error (Missing Operator) in Query expression ':0:1 Pin
PIEBALDconsult23-Jan-13 16:59
mvePIEBALDconsult23-Jan-13 16:59 
AnswerRe: Syntax error (Missing Operator) in Query expression ':0:1 Pin
Richard MacCutchan23-Jan-13 23:22
mveRichard MacCutchan23-Jan-13 23:22 
GeneralRe: Syntax error (Missing Operator) in Query expression ':0:1 Pin
PIEBALDconsult24-Jan-13 5:48
mvePIEBALDconsult24-Jan-13 5:48 
GeneralRe: Syntax error (Missing Operator) in Query expression ':0:1 Pin
IgaBaro24-Jan-13 5:54
IgaBaro24-Jan-13 5:54 
GeneralRe: Syntax error (Missing Operator) in Query expression ':0:1 Pin
PIEBALDconsult24-Jan-13 6:00
mvePIEBALDconsult24-Jan-13 6:00 
GeneralRe: Syntax error (Missing Operator) in Query expression ':0:1 Pin
IgaBaro24-Jan-13 7:11
IgaBaro24-Jan-13 7:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.