Originally posted by Abigail Moore: I have the following sql:
SELECT customer_id, hierarchy_id, hierarchy_type_cd, primary_station, primary_type_cd FROM ebat.ha_station_hierarchy_811 WHERE customer_id = '9999999999' AND primary_station = '5629402401'
This returns 2 rows of data where primary_type_cd is different. How do I change this sql so that it rolls the 2 rows of data into 1, ignoring the difference in the primary_type_cd?
Thanks for the help
Note the addition of the DISTINCT keyword, and the removal of the primary_type_cd column from the selection criteria; since there are two different values and you want just one row, you either have to pick a particular value of primary_type_cd or omit it.
An example of picking one of the primary_type_cd values is:
The success of this SQL depends on what your database actually supports and the actual data type of the primary_type_cd column; it might not work for you on your particular database, but something else along those lines will.
Joined: May 13, 2004
Thank you! I will try that, I did try distinct but didn't remove primary_type_cd.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com