Hello all!
Have a question:
Is there way in SQL to determine duplicate rows without using count(), aggregate functions, group by or select distinct?
I only have regular select, join and delete features.
Basically, what are all the possible ways to determine duplicates in data like this?
col1|col2
----
s1--j1
s1--j4
s1--j1
s1--j3
s1--j2
I greatly appreciate your response!
Thanks!You need to add a third column, a unique ID column. Then you can do this
select t1.* from t1
join t2 on t1.col1=t2.col2 and t1.col2=t2.col2 and t1.id != t2.id
Check out my brand new SQL tutorial at http://www.bitesizeinc.net/index.php/sql.html
-Chris
http://www.bitesizeinc.net/|||Is there way to do it without a unique ID? Not to be persistent, but my original goal was to do it only with those simple SQL statements.
I just wanted to make sure that I tried every way possible. Maybe there is a way to use cartesian product or whichever, but it's gotta be based on these simple statements.
If it can only be done using unique ID or aggregate functions, it's a good answer as well.
Let me know if I sound confusing. Great site btw, very original!.
Thanks for your devotion.|||Thank you so much for visitting my site...
I think that you're out of options here.
The best way is using GROUP BY.
Otherwise, you could select DISTINCT CONCAT(field1,' ',field2)
Or use the unique ID
I can't think of anyway else...
-Chrissql
Showing posts with label functions. Show all posts
Showing posts with label functions. Show all posts
Friday, March 30, 2012
Monday, February 20, 2012
Public Role
In BOL (regarding the Public Role) it states, as one of its functions:
"Captures all default permissions for users in a database."
How does one assign default permissions for a user?
Message posted via droptable.com
http://www.droptable.com/Uwe/Forums...erver/200511/1
Every user in a database has, by default, the permissions granted to the
public role. So, you grant permissions to the user by granting permissions to
the public role. But ...
From BOL "A user receives the union of all the permissions granted, denied,
or revoked on an object, with any denied permissions taking precedence over
the same permissions granted or revoked at another level".
Ben Nevarez
"Robert R via droptable.com" wrote:
> In BOL (regarding the Public Role) it states, as one of its functions:
> "Captures all default permissions for users in a database."
> How does one assign default permissions for a user?
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forums...erver/200511/1
>
|||Ben explained how all users inherit permissions from the public rile. I'd
like to add that you might consider using user-defined roles instead of
public so that you can more granularly control security. Personally, I only
use the public role for default system catalog permissions.
Hope this helps.
Dan Guzman
SQL Server MVP
"Robert R via droptable.com" <u3288@.uwe> wrote in message
news:5775935dde74c@.uwe...
> In BOL (regarding the Public Role) it states, as one of its functions:
> "Captures all default permissions for users in a database."
> How does one assign default permissions for a user?
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forums...erver/200511/1
"Captures all default permissions for users in a database."
How does one assign default permissions for a user?
Message posted via droptable.com
http://www.droptable.com/Uwe/Forums...erver/200511/1
Every user in a database has, by default, the permissions granted to the
public role. So, you grant permissions to the user by granting permissions to
the public role. But ...
From BOL "A user receives the union of all the permissions granted, denied,
or revoked on an object, with any denied permissions taking precedence over
the same permissions granted or revoked at another level".
Ben Nevarez
"Robert R via droptable.com" wrote:
> In BOL (regarding the Public Role) it states, as one of its functions:
> "Captures all default permissions for users in a database."
> How does one assign default permissions for a user?
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forums...erver/200511/1
>
|||Ben explained how all users inherit permissions from the public rile. I'd
like to add that you might consider using user-defined roles instead of
public so that you can more granularly control security. Personally, I only
use the public role for default system catalog permissions.
Hope this helps.
Dan Guzman
SQL Server MVP
"Robert R via droptable.com" <u3288@.uwe> wrote in message
news:5775935dde74c@.uwe...
> In BOL (regarding the Public Role) it states, as one of its functions:
> "Captures all default permissions for users in a database."
> How does one assign default permissions for a user?
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forums...erver/200511/1
Public Role
In BOL (regarding the Public Role) it states, as one of its functions:
"Captures all default permissions for users in a database."
How does one assign default permissions for a user?
Message posted via droptable.com
http://www.droptable.com/Uwe/Forum...server/200511/1Every user in a database has, by default, the permissions granted to the
public role. So, you grant permissions to the user by granting permissions t
o
the public role. But ...
From BOL "A user receives the union of all the permissions granted, denied,
or revoked on an object, with any denied permissions taking precedence over
the same permissions granted or revoked at another level".
Ben Nevarez
"Robert R via droptable.com" wrote:
> In BOL (regarding the Public Role) it states, as one of its functions:
> "Captures all default permissions for users in a database."
> How does one assign default permissions for a user?
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forum...server/200511/1
>|||Ben explained how all users inherit permissions from the public rile. I'd
like to add that you might consider using user-defined roles instead of
public so that you can more granularly control security. Personally, I only
use the public role for default system catalog permissions.
Hope this helps.
Dan Guzman
SQL Server MVP
"Robert R via droptable.com" <u3288@.uwe> wrote in message
news:5775935dde74c@.uwe...
> In BOL (regarding the Public Role) it states, as one of its functions:
> "Captures all default permissions for users in a database."
> How does one assign default permissions for a user?
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forum...server/200511/1
"Captures all default permissions for users in a database."
How does one assign default permissions for a user?
Message posted via droptable.com
http://www.droptable.com/Uwe/Forum...server/200511/1Every user in a database has, by default, the permissions granted to the
public role. So, you grant permissions to the user by granting permissions t
o
the public role. But ...
From BOL "A user receives the union of all the permissions granted, denied,
or revoked on an object, with any denied permissions taking precedence over
the same permissions granted or revoked at another level".
Ben Nevarez
"Robert R via droptable.com" wrote:
> In BOL (regarding the Public Role) it states, as one of its functions:
> "Captures all default permissions for users in a database."
> How does one assign default permissions for a user?
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forum...server/200511/1
>|||Ben explained how all users inherit permissions from the public rile. I'd
like to add that you might consider using user-defined roles instead of
public so that you can more granularly control security. Personally, I only
use the public role for default system catalog permissions.
Hope this helps.
Dan Guzman
SQL Server MVP
"Robert R via droptable.com" <u3288@.uwe> wrote in message
news:5775935dde74c@.uwe...
> In BOL (regarding the Public Role) it states, as one of its functions:
> "Captures all default permissions for users in a database."
> How does one assign default permissions for a user?
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forum...server/200511/1
Public Role
In BOL (regarding the Public Role) it states, as one of its functions:
"Captures all default permissions for users in a database."
How does one assign default permissions for a user?
--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200511/1Every user in a database has, by default, the permissions granted to the
public role. So, you grant permissions to the user by granting permissions to
the public role. But ...
From BOL "A user receives the union of all the permissions granted, denied,
or revoked on an object, with any denied permissions taking precedence over
the same permissions granted or revoked at another level".
Ben Nevarez
"Robert R via SQLMonster.com" wrote:
> In BOL (regarding the Public Role) it states, as one of its functions:
> "Captures all default permissions for users in a database."
> How does one assign default permissions for a user?
> --
> Message posted via SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200511/1
>|||Ben explained how all users inherit permissions from the public rile. I'd
like to add that you might consider using user-defined roles instead of
public so that you can more granularly control security. Personally, I only
use the public role for default system catalog permissions.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Robert R via SQLMonster.com" <u3288@.uwe> wrote in message
news:5775935dde74c@.uwe...
> In BOL (regarding the Public Role) it states, as one of its functions:
> "Captures all default permissions for users in a database."
> How does one assign default permissions for a user?
> --
> Message posted via SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200511/1
"Captures all default permissions for users in a database."
How does one assign default permissions for a user?
--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200511/1Every user in a database has, by default, the permissions granted to the
public role. So, you grant permissions to the user by granting permissions to
the public role. But ...
From BOL "A user receives the union of all the permissions granted, denied,
or revoked on an object, with any denied permissions taking precedence over
the same permissions granted or revoked at another level".
Ben Nevarez
"Robert R via SQLMonster.com" wrote:
> In BOL (regarding the Public Role) it states, as one of its functions:
> "Captures all default permissions for users in a database."
> How does one assign default permissions for a user?
> --
> Message posted via SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200511/1
>|||Ben explained how all users inherit permissions from the public rile. I'd
like to add that you might consider using user-defined roles instead of
public so that you can more granularly control security. Personally, I only
use the public role for default system catalog permissions.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Robert R via SQLMonster.com" <u3288@.uwe> wrote in message
news:5775935dde74c@.uwe...
> In BOL (regarding the Public Role) it states, as one of its functions:
> "Captures all default permissions for users in a database."
> How does one assign default permissions for a user?
> --
> Message posted via SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200511/1
Subscribe to:
Posts (Atom)