Re: sql question
Posted in 1993
U19692@uicvm.uic.edu wrote: :[...] : IF ALL MY IF-THEN STATEMENTS ARE FALSE, I DONT WANT TO PRINT ANYTHING (NOT THE : HEADER INFORMATION EITHER.) : WHEN I RUN MY REPORT, (PER BATCH), I GET 25 PRINTED PAGES OF WHICH ONLY : 4 PAGES HAVE THE INFORMATION THAT I NEED. 21 PAGES ARE WASTAGE. ON : THOSE 21 PAGES ALL I GET IS THEADER INFORMATION (THE FIELDS ARE ALL : FALSE THEREFORE THEY DONT PRINT). I WANT TO PRINT ONLY 4 PAGES : WITH HEADER AND ALL THE FIELD NAMES THAT MATCH IF-THEN (TRUE). : HERE IS PART OF MY REPORT: : DATABASE RADC : END : SELECT * FROM RAD101 : WHERE BATCH_ID = "0312" : ORDER BY PAT_ID : [...] This statement selects all rows with the specified batch id and delivers them to the format routine. That way, you get a printout for each selected row, even if it doesn't meet your "if-then-else" criteria in the "on every row" part. The "page header" is printed every time you start a new page. If you only want a printout for the rows that meet your criteria, you have to place those criteria in the select statement so that only the desired rows are delivered to the format routine. Hope that helps, Richard -- +----------------------------+-------------------------------------------+ | Dr. Richard Spitz | INTERNET: spitz@ana.med.uni-muenchen.de | | EDV-Gruppe Anaesthesie | Tel : +49-89-7095-3421 | | Klinikum Grosshadern | FAX : +49-89-7095-8886 | | Munich, Germany | | +----------------------------+-------------------------------------------+