Quantcast
Channel: SCN : Unanswered Discussions - SAP Crystal Reports
Viewing all articles
Browse latest Browse all 4814

Creating a command Object

$
0
0

I am trying to link on a portion of a field in one table to link to another table.  Since I need to only link on the left 3 characters of the field, I am trying to create a command object like below however it is not working and I am not very familiar with SQL syntax.

 

SELECT Left ('PRODUCT_CODE',3) as 'Major'

FROM 'Invoice_Archive_Line_Items'

 

In the field name from the Select statement, do I need to include the table name with the field?

Invoice_Archive_Line_Items.PRODUCT_CODE

 

Also here is a sample of previously run SQL from the report:

I have tried to put double quotes around it as well but still can't get it to work.  Any help is appreciated.

 

Thank you

 

 

SELECT
"Invoice_Archive_Line_Items"."PRODUCT_CODE",
"Invoice_Archive_Header"."INVOICE_NUMBER",
"Invoice_Archive_Header"."CUSTOMER_CODE",
"Invoice_Archive_Header"."SHIPTO_CODE",
"Invoice_Archive_Header"."INVOICE_DATE",
"Invoice_Archive_Header"."SATELLITE_NUMBER",
"Invoice_Archive_Line_Items"."NET_PRICE_EXTENSION",
"Invoice_Archive_Line_Items"."QTY_SHIPPED",
"Invoice_Archive_Line_Items"."ITEM_DESCRIPTION_1",
"Invoice_Archive_Header"."OUTSIDE_SALESPERSON_CODE",
"Customer_Master_File"."CUSTOMER_CODE", "General_Table_File"."TABLE_CODE",
"General_Table_File"."TABLE_ID",
"General_Table_File"."TABLE_FLD11",
"Invoice_Archive_Header"."SHIPPED_FROM_CODE",
"Salesperson_Master"."NAME",
"Customer_Master_File"."NAME",
"Ship_to_File"."NAME",
"Customer_Master_File"."ACRONYM",
"Invoice_Archive_Line_Items"."ODBC_LINE_NUMBER"

 

 

FROM   "Invoice Archive Header"
"Invoice_Archive_Header", "Invoice Archive Line Items"
"Invoice_Archive_Line_Items", "Salesperson Master"
"Salesperson_Master", "Ship-to File"
"Ship_to_File", "Inventory Master File"
"Inventory_Master_File", "General Table File"
"General_Table_File", "Customer Master File"
"Customer_Master_File"

 

 

WHERE
("Invoice_Archive_Header"."INVOICE_NUMBER"="Invoice_Archive_Line_Items"."ODBC_INVOICE_NUMBER")
AND


Viewing all articles
Browse latest Browse all 4814

Trending Articles