mbeals Posted June 2, 2008 Share Posted June 2, 2008 I have a table that stores information about IP address assignments for multiple sites. Each tuple contains the site's name, the device type, it's public (management) IP address and a few other attributes. The sites are all multihomed, meaning that a single device can be (but doesn't have to be) listed twice in the table, as it would have 2 public IP's. I'm attempting to write a query to list each unique device per site (Ignoring IP). For instance, take the following set of tuples: SiteDeviceIP Office 1gateway router123.456.798.1 Office 1gateway router123.456.700.1 Office 1printer123.456.798.2 Labprinter987.654.987.5 I need to query to return: SiteDevice Office 1gateway router Office 1printer Labprinter Simple distinct statements won't work. I'm thinking Its going to have to be a sub query or an alias Link to comment https://forums.phpfreaks.com/topic/108376-solved-distinct-sub-query/ Share on other sites More sharing options...
fenway Posted June 2, 2008 Share Posted June 2, 2008 Why not SELECT DISTINCT site, device? Link to comment https://forums.phpfreaks.com/topic/108376-solved-distinct-sub-query/#findComment-555626 Share on other sites More sharing options...
mbeals Posted June 2, 2008 Author Share Posted June 2, 2008 thanks, Wasn't aware I could do that. Link to comment https://forums.phpfreaks.com/topic/108376-solved-distinct-sub-query/#findComment-555630 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.