list all zip to zip permutations

I have a zip code listing and need to create a zip to zip listing. The order of the zips do matter so if I have 01001 to 17325, i still would need the reverse too, 17325 to 01001. I don't think I can do this in excel because of the 1 million row limit but can I do this in sql?
Who is Participating?
deightonConnect With a Mentor progCommented:
SELECT, FROM YourTable t1 JOIN YourTable t2 ON <>
Garry GlendownConsulting and Network/Security SpecialistCommented:
Pretty simple code ...

select a.zipcode FromZip, b.zipcode ToZip from zip a, zip b where a.zipcode!=b.zipcode;

Open in new window

Drop the "where" if you also want same zipcodes listed as from and to ...
Anthony PerkinsCommented:
And that is going to be a big table, with somewhere around 2.5 billion rows.
k1ng87Author Commented:
yeah...i dont think this is going to be practical as the row count will be insane...but the solution did work!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.