I'd like to bounce a question off the SQL gurus on the list. I have a file that has 3 records like this:
So, 3 records, one each for store, register, and receipt, all with the same PIN value.
I have a program that reads another file having a bunch of records, each with a set of the store, register, and receipt values. My program takes a set of those values and uses an SQL statement to read the "FILE A" file shown in the table, trying to retrieve the PIN number (the 1234567) that is common to all 3 records. Here is that SQL:
select PIN from FILE A where
STORE = 1
or REGISTER = 1
or RECEIPT = 1
group by PIN having count(*) = 3;
This works. The problem is that it's a DOG from a performance standpoint, due to the "verticalness" of the data setup. Can anyone out there recommend a better SQL script, or maybe even just a straight set of code without SQL, that would return the same thing and be a lot faster? I'd appreciate any suggestions. Thanks!
AmTrust North America
800 Superior Avenue E, 18th Floor
Cleveland, OH 44114
Confidentiality Notice: This email message is intended only for the individual or entity to which it is addressed. This email may contain information that is proprietary or privileged, confidential and exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you received this email by accident, please notify the sender immediately and destroy this email and all copies of it.