-1

hey guys need your help

TEXTBOX VALUES

brand | model | description

A | B | C

BRAND AND MODEL ARE CONCATENATED as Equipment

Equipment | description

A B   |       C

with selectionchange, what do i need to do in order to separate Brand and model to display their values in Different textboxes

select concat(Equipment.EqName , ' ', Equipment.EqBrand , ' ', Equipment.EqModel) as Items ,Equipment.EqDesc ,Qty, UnitPrice
from POItems inner join Equipment on POItems .EqID = Equipment.EqID where POItems.POID is NULL group by POItems.POItemsID, Qty, Equipment.EqName , Equipment.EqBrand , Equipment.EqModel ,Equipment.EqDesc , UnitPrice

  • How are concatenating the values? You just need to do reverse of it. You need to split the string by the same character which you use to join them. – Chetan Aug 21 '17 at 10:18
  • https://stackoverflow.com/help/mcve – mjwills Aug 21 '17 at 11:35
  • select concat(Equipment.EqName , ' ', Equipment.EqBrand , ' ', Equipment.EqModel) as Items ,Equipment.EqDesc ,Qty, UnitPrice from POItems inner join Equipment on POItems .EqID = Equipment.EqID where POItems.POID is NULL group by POItems.POItemsID, Qty, Equipment.EqName , Equipment.EqBrand , Equipment.EqModel ,Equipment.EqDesc , UnitPrice this is my query so far...can you show me on how to split them – Peter Pari-an Ema Aug 21 '17 at 11:44

1 Answers1

-1

what do i need to do in order to separate Brand and model to display their values in Different textboxes

select concat(Equipment.EqName , ' ', Equipment.EqBrand , ' ', Equipment.EqModel) as Items ,Equipment.EqDesc ,Qty, UnitPrice
from POItems inner join Equipment on POItems .EqID = Equipment.EqID where POItems.POID is NULL group by POItems.POItemsID, Qty, Equipment.EqName , Equipment.EqBrand , Equipment.EqModel ,Equipment.EqDesc , UnitPrice

In the above SQL you are concatenating EqName, EqBrand and EqModel together. So you need to specifically include the individual columns you want (i.e. Brand and Model). This SQL should work:

select Equipment.EqBrand, Equipment.EqModel, concat(Equipment.EqName , ' ', Equipment.EqBrand , ' ', Equipment.EqModel) as Items , Equipment.EqDesc ,Qty, UnitPrice
from POItems inner join Equipment on POItems .EqID = Equipment.EqID where POItems.POID is NULL group by POItems.POItemsID, Qty, Equipment.EqName , Equipment.EqBrand , Equipment.EqModel ,Equipment.EqDesc , UnitPrice

Once that is done, you can bind that data into your existing DataGrid and hide those columns so that the user can't see them.

mjwills
  • 23,389
  • 6
  • 40
  • 63