I have a database where each row has an id, a URL, and an XML. The IDs are unique, but URLs column can have duplicates. I need all the URLs, without duplicates, and for each URL I need the id and XML.
If I ask only for the URL and the Id, I use the following query:
select URL, max(ID) as ID from T1 group by URL
And all is working great.
But when I want also the XML, and I use the following query:
select URL, max(ID) as ID, XML from T1 group by URL
I get the following error:
ISC ERROR CODE:335544569 ISC ERROR MESSAGE: Dynamic SQL Error SQL error code = -104 user name required
What am I doing wrong?
Thanks,
Dikla
Thanks for the answers. I want to add an explanation:
In case of duplicate URLs, I don’t care which of them will be returned. But I need to get them without duplicates, even if the XML is different between the rows. Is it possible?
Thanks!
would give you rows with duplicate urls removed (and only the first instance of duplicate urls included)