× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hello all,

I'd like to bounce a question off the SQL gurus on the list. I have a file that has 3 records like this:


FILE A:
Store 1

PIN 1234567

Register 1

PIN 1234567

Receipt 1

PIN 1234567


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!


Bill Howie
Software Developer
AmTrust North America
800 Superior Avenue E, 18th Floor
Cleveland, OH 44114
216.328.6292

________________________________
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.

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.