Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Missing Right Paran? Post Reply Post New Topic
Author Message
Tycanis
Newbie
Newbie


Joined: 18 Jul 2011
Location: United States
Online Status: Offline
Posts: 11
Quote Tycanis Replybullet Topic: Missing Right Paran?
     Posted: 15 Feb 2013 at 10:38am
I get an error from this that says I am missing a right paran.  I am trying to put this in a command.  Everything works except the last and on the where statements.  Without everything is good but I get duplicate values in the SCAN_BARCODE field when barcodes are scanned more than once at different times.  Please help.
 
SELECT DISTINCT SCAN_CREATE_TM,
SCAN_BARCODE,
SCAN_CREATE_DT,
Null as PROCESS_IORG_NBR,
SCAN_IORG_NBR,
Null as SCAN_TYPE_CODE,
USER_ID,
Null as SCAN_USER
 FROM   hidden
PRELOAD_INBOUND
WHERE  (SCAN_CREATE_DT={?Scan Date} AND SCAN_IORG_NBR={?Ground Station Number} AND (SCAN_BARCODE LIKE '0000070000%' or SCAN_BARCODE LIKE '9%') AND
(SCAN_CREATE_TM = (SELECT MIN(SCAN_CREATE_TM) FROM PRELOAD_INBOUND AS TBL2 WHERE PRELOAD_INBOUND.SCAN_BARCODE = TBL2.SCAN_BARCODE)))
UNION ALL
SELECT DISTINCT SCAN_CREATE_TM,
SCAN_BARCODE,
SCAN_CREATE_DT,
PROCESS_IORG_NBR,
Null as SCAN_IORG_NMB,
SCAN_TYPE_CODE,
Null as USER_ID,
SCAN_USER
 FROM   hidden
INBOUND_SCAN
WHERE  (SCAN_TYPE_CODE='I' AND SCAN_CREATE_DT={?Scan Date} AND PROCESS_IORG_NBR={?HD Station Number} AND (SCAN_BARCODE LIKE '0000070000%' or SCAN_BARCODE LIKE '9%') AND
(SCAN_CREATE_TM = (SELECT MIN(SCAN_CREATE_TM) FROM INBOUND_SCAN AS TBL2 WHERE INBOUND_SCAN.SCAN_BARCODE = TBL2.SCAN_BARCODE)))


Edited by Tycanis - 15 Feb 2013 at 10:42am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 15 Feb 2013 at 10:59am
i think you need to remove the last close parenth on each where clauses


IP IP Logged
Tycanis
Newbie
Newbie


Joined: 18 Jul 2011
Location: United States
Online Status: Offline
Posts: 11
Quote Tycanis Replybullet Posted: 15 Feb 2013 at 11:17am
Tried.  Still gives the same error.  Thanks though.
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 20 Feb 2013 at 1:59am
Hi

Try this :

Note : Union All will give you duplicates and UNION will give you unique values.


SELECT DISTINCT SCAN_CREATE_TM,
SCAN_BARCODE,
SCAN_CREATE_DT,
Null as PROCESS_IORG_NBR,
SCAN_IORG_NBR,
Null as SCAN_TYPE_CODE,
USER_ID,
Null as SCAN_USER
 FROM   hidden
PRELOAD_INBOUND
WHERE
SCAN_CREATE_DT={?Scan Date} AND
SCAN_IORG_NBR={?Ground Station Number} AND
(SCAN_BARCODE LIKE '0000070000%' or SCAN_BARCODE LIKE '9%') AND
SCAN_CREATE_TM = (SELECT MIN(SCAN_CREATE_TM) FROM PRELOAD_INBOUND AS TBL2 WHERE PRELOAD_INBOUND.SCAN_BARCODE = TBL2.SCAN_BARCODE)
UNION
SELECT DISTINCT SCAN_CREATE_TM,
SCAN_BARCODE,
SCAN_CREATE_DT,
PROCESS_IORG_NBR,
Null as SCAN_IORG_NMB,
SCAN_TYPE_CODE,
Null as USER_ID,
SCAN_USER
 FROM   hidden
INBOUND_SCAN
WHERE 
SCAN_TYPE_CODE='I' AND
SCAN_CREATE_DT={?Scan Date} AND
PROCESS_IORG_NBR={?HD Station Number} AND
(SCAN_BARCODE LIKE '0000070000%' or SCAN_BARCODE LIKE '9%') AND
SCAN_CREATE_TM = (SELECT MIN(SCAN_CREATE_TM) FROM INBOUND_SCAN AS TBL2 WHERE INBOUND_SCAN.SCAN_BARCODE = TBL2.SCAN_BARCODE)
Thanks,
Sastry
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum