Showing posts with label recordcount. Show all posts
Showing posts with label recordcount. Show all posts

Monday, February 20, 2012

RecordCount with Datareader

I am very disappinted where Datareader have no RecordCount where I can get the total records it read. I guess I found a way:

sql = "SELECT *, ROW_NUMBER() OVER (ORDER BY id DESC) AS c FROM ACCOUNTS ORDER BY c DESC"
Dim command As SqlCommand = New SqlCommand(sql, New SqlConnection(_DBConnectionString))
command.Connection.Open()
_ReturnDataReader = command.ExecuteReader(CommandBehavior.CloseConnection)
command.Dispose()
_TotalRecord = _ReturnDataReader.GetInt64(_ReturnDataReader.GetOrdinal("c"))

Have SQL Server 2005 count for me...

Hi,

You can get the record count this way:

Dim

drAs SqlDataReader = AnyFunctionThatReturnsSqlDataReader()
Dim reccountAsInteger = 0
While dr.Read
reccount += 1
EndWhile

Good luck!

Wilmar, KSA (Mabuhay!)

Recordcount logging

Hi,

I may be blind but is there no other way to capture the recordcount flowing through a pipeline as by using the RecordCount transform? I looked into EventManagers and the standard SSIS Logging but didn't find anything about that...! At least ProgressCountHigh/Low don't return something reasonable for me...

Thanks,

Thomas,

Not really, no. Mark Hill has build a custom component to do it (http://markiehillmsis.blogspot.com/2005/12/custom-components-in-integration.html) but in my opinion it doesn't give you anything that the ROWCOUNT transform doesn't give you except a custom event and in my opinion the same can be achieved using the OnPostExecute event.

Why is the ROWCOUNT transform not sufficient?

ProgressCount high/low doesn't give you anything useful. In fact I'm still trying to work out why on earth its there - as far as I can see it doesn't have any meaning.

-Jamie

|||

Jamie,

the idea was to have something like a "generic" rowcount... You wouldn't need all the rowcounts if all the transforms throw the onprogress event with a reasonable ProgressCount. You simply add your event and decide if you want to log that or not... That would save you a bunch of time...

But perhaps this is something for the wishlist....

Recordcount Issue

This is weird. I have (identical) copies of sql server running on two seperate machines. I have a vb app that accesses the data. It runs with both dbs but I have the following function that I call to show the record count in a particular display:

Code:------------------------

Dim rs As Recordset

'determines number of records in a sql statement
Set rs = New ADODB.Recordset
rs.Open sql, conn, adOpenStatic, adLockOptimistic
RecordCount = rs.RecordCount
rs.Close
Set rs = Nothing

------------------------With one db it works just fine but with the other it returns a value of -1 even though the data is displayed just fine. Any ideas?You need to make sure that you have a client side sursor for this to work.

I always work with disconnected recorsets so it's not an issue.|||I'm not a VB expert, but I think you need to use rs.movelast in order to get an accurate count.

blindman

RecordCount in SQL CE?

Does somebody know how to obtain the recordcount from a SqlCeResultSet ?

Thanks in advance!

See this.

|||

Ilya,

Please could you explain your post a little more, since I cannot make it to work.

int rowCount = ((IBindingList)resultSet.ResultSetView).Count;

I'm using VS 2005, Net CF 2.0 SP2 and SQL CE 3.1

thanks in advance!

|||

I’m not quite sure what to explain here, this single line of code is rather primitive. Let me try it: you get ResultSetView from ResultSet, cast it to IBindingList and get Count property which contains number of records.

Are you a VB developer? If so use any free online C# to VB converter to get VB code.

|||

int count = ((System.Collections.ICollection)rs.ResultSetView).Count;

You could try using above line to get the row count of the ResultSet.

RecordCount in SQL CE?

Does somebody know how to obtain the recordcount from a SqlCeResultSet ?

Thanks in advance!

See this.

|||

Ilya,

Please could you explain your post a little more, since I cannot make it to work.

int rowCount = ((IBindingList)resultSet.ResultSetView).Count;

I'm using VS 2005, Net CF 2.0 SP2 and SQL CE 3.1

thanks in advance!

|||

I’m not quite sure what to explain here, this single line of code is rather primitive. Let me try it: you get ResultSetView from ResultSet, cast it to IBindingList and get Count property which contains number of records.

Are you a VB developer? If so use any free online C# to VB converter to get VB code.

|||

int count = ((System.Collections.ICollection)rs.ResultSetView).Count;

You could try using above line to get the row count of the ResultSet.

RecordCount -1

This is a multi-part message in MIME format.
--=_NextPart_000_0057_01C44D4D.A2D86E10
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello,
I am using the function below to get some values form database.
However for RecordCount it always returns -1.
Any clues hot to fix it?
Thx
YuriW
Function RunSQL (sConnection_String, sSQL_QUERY) Dim db_object Dim sSQL_string
'connection_string =3D "DSN=3DMagnetic;UID=3Dlaurel;PWD=3Duklever"
sSQL_string =3D sSQL_QUERY
' Create the conection object.
Set db_object =3D CreateObject("ADODB.Connection")
' or use this method if a DSN entry was created.
db_object.Open(sConnection_String)
' Get the recordset returned from a select query.
Set recordset =3D db_object.Execute(sSQL_string)
' Display the results of the query.
sOut =3D recordset.RecordCount
RunSQL =3D sOut
' Close the database connection.
db_object.Close
Set db_object =3D Nothing
End Function
--=_NextPart_000_0057_01C44D4D.A2D86E10
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&
Hello,
I am using the function below to get some values form = database.
However for RecordCount it always returns -1.
Any clues hot to fix it?

Thx
YuriW

Function RunSQL (sConnection_String, sSQL_QUERY) Dim = db_object Dim sSQL_string 'connection_string =3D "DSN=3DMagnetic;UID=3Dlaurel;PWD=3Duklever" sSQL_string =3D sSQL_QUERY
' Create the conection object. Set db_object =3D CreateObject("ADODB.Connection")

' or use this method if a DSN entry was = created. db_object.Open(sConnection_String)

' Get the recordset returned from a select query. = Set recordset =3D db_object.Execute(sSQL_string)

' Display the results of the query.

sOut =3D recordset.RecordCount
RunSQL =3D sOut

' Close the database connection. = db_object.Close Set db_object =3D Nothing

End Function
</FONT></FONT>
--=_NextPart_000_0057_01C44D4D.A2D86E10--http://www.aspfaq.com/2193
--
http://www.aspfaq.com/
(Reverse address to reply.)
"Yuri Weinstein (HotMail)" <yuriw_NOSPAM@.hotmail.com> wrote in message
news:7Mnxc.68469$yx3.34214@.newssvr29.news.prodigy.com...
Hello,
I am using the function below to get some values form database.
However for RecordCount it always returns -1.
Any clues hot to fix it?
Thx
YuriW
Function RunSQL (sConnection_String, sSQL_QUERY)
Dim db_object
Dim sSQL_string
'connection_string = "DSN=Magnetic;UID=laurel;PWD=uklever"
sSQL_string = sSQL_QUERY
' Create the conection object.
Set db_object = CreateObject("ADODB.Connection")
' or use this method if a DSN entry was created.
db_object.Open(sConnection_String)
' Get the recordset returned from a select query.
Set recordset = db_object.Execute(sSQL_string)
' Display the results of the query.
sOut = recordset.RecordCount
RunSQL = sOut
' Close the database connection.
db_object.Close
Set db_object = Nothing
End Function|||Thanks you. I am still not clear how to change the code in order to fix it?
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:eyU6tjYTEHA.3580@.TK2MSFTNGP09.phx.gbl...
> http://www.aspfaq.com/2193
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "Yuri Weinstein (HotMail)" <yuriw_NOSPAM@.hotmail.com> wrote in message
> news:7Mnxc.68469$yx3.34214@.newssvr29.news.prodigy.com...
> Hello,
> I am using the function below to get some values form database.
> However for RecordCount it always returns -1.
> Any clues hot to fix it?
> Thx
> YuriW
> Function RunSQL (sConnection_String, sSQL_QUERY)
> Dim db_object
> Dim sSQL_string
> 'connection_string = "DSN=Magnetic;UID=laurel;PWD=uklever"
> sSQL_string = sSQL_QUERY
> ' Create the conection object.
> Set db_object = CreateObject("ADODB.Connection")
> ' or use this method if a DSN entry was created.
> db_object.Open(sConnection_String)
> ' Get the recordset returned from a select query.
> Set recordset = db_object.Execute(sSQL_string)
> ' Display the results of the query.
> sOut = recordset.RecordCount
> RunSQL = sOut
> ' Close the database connection.
> db_object.Close
> Set db_object = Nothing
> End Function
>|||Maybe you need to look at the article again?
--
http://www.aspfaq.com/
(Reverse address to reply.)
"Yuri Weinstein (HotMail)" <yuriw_NOSPAM@.hotmail.com> wrote in message
news:dnoxc.68491$iR3.59055@.newssvr29.news.prodigy.com...
> Thanks you. I am still not clear how to change the code in order to fix
it?
>
> "Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
> news:eyU6tjYTEHA.3580@.TK2MSFTNGP09.phx.gbl...
> > http://www.aspfaq.com/2193
> >
> > --
> > http://www.aspfaq.com/
> > (Reverse address to reply.)
> >
> >
> >
> >
> > "Yuri Weinstein (HotMail)" <yuriw_NOSPAM@.hotmail.com> wrote in message
> > news:7Mnxc.68469$yx3.34214@.newssvr29.news.prodigy.com...
> > Hello,
> > I am using the function below to get some values form database.
> > However for RecordCount it always returns -1.
> > Any clues hot to fix it?
> >
> > Thx
> > YuriW
> >
> > Function RunSQL (sConnection_String, sSQL_QUERY)
> > Dim db_object
> > Dim sSQL_string
> >
> > 'connection_string = "DSN=Magnetic;UID=laurel;PWD=uklever"
> > sSQL_string = sSQL_QUERY
> >
> > ' Create the conection object.
> > Set db_object = CreateObject("ADODB.Connection")
> >
> > ' or use this method if a DSN entry was created.
> > db_object.Open(sConnection_String)
> >
> > ' Get the recordset returned from a select query.
> > Set recordset = db_object.Execute(sSQL_string)
> >
> > ' Display the results of the query.
> >
> > sOut = recordset.RecordCount
> >
> > RunSQL = sOut
> >
> > ' Close the database connection.
> > db_object.Close
> > Set db_object = Nothing
> >
> > End Function
> >
> >
>|||This is a multi-part message in MIME format.
--=_NextPart_000_00C3_01C44D70.C4F36D60
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Recordcount is not supported with the default forward-only cursor. You =can try to set the type of cursor before you excute your SQL code.
"Yuri Weinstein (HotMail)" <yuriw_NOSPAM@.hotmail.com> wrote in message =news:7Mnxc.68469$yx3.34214@.newssvr29.news.prodigy.com...
Hello,
I am using the function below to get some values form database.
However for RecordCount it always returns -1.
Any clues hot to fix it?
Thx
YuriW
Function RunSQL (sConnection_String, sSQL_QUERY) Dim db_object Dim sSQL_string
'connection_string =3D "DSN=3DMagnetic;UID=3Dlaurel;PWD=3Duklever"
sSQL_string =3D sSQL_QUERY
' Create the conection object.
Set db_object =3D CreateObject("ADODB.Connection")
' or use this method if a DSN entry was created.
db_object.Open(sConnection_String)
' Get the recordset returned from a select query.
Set recordset =3D db_object.Execute(sSQL_string)
' Display the results of the query.
sOut =3D recordset.RecordCount
RunSQL =3D sOut
' Close the database connection.
db_object.Close
Set db_object =3D Nothing
End Function
--=_NextPart_000_00C3_01C44D70.C4F36D60
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&

Recordcount is not supported with the default forward-only cursor. =You can try to set the type of cursor before you excute your SQL code.
"Yuri Weinstein (HotMail)" = wrote in message news:7Mnxc=.68469$yx3.34214@.newssvr29.news.prodigy.com...
Hello,
I am using the function below to get some values form =database.
However for RecordCount it always returns -1.
Any clues hot to fix it?

Thx
YuriW

Function RunSQL (sConnection_String, sSQL_QUERY) Dim =db_object Dim sSQL_string 'connection_string =3D "DSN=3DMagnetic;UID=3Dlaurel;PWD=3Duklever" sSQL_string =3D sSQL_QUERY
' Create the conection object. Set db_object =3D = CreateObject("ADODB.Connection")

' or use this method if a DSN entry was =created. db_object.Open(sConnection_String)

' Get the recordset returned from a select =query. Set recordset =3D db_object.Execute(sSQL_string)

' Display the results of the query.

sOut =3D recordset.RecordCount
RunSQL =3D sOut

' Close the database connection. db_object.Close Set db_object =3D Nothing

End Function

--=_NextPart_000_00C3_01C44D70.C4F36D60--|||Got it, thx!
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:eyU6tjYTEHA.3580@.TK2MSFTNGP09.phx.gbl...
> http://www.aspfaq.com/2193
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "Yuri Weinstein (HotMail)" <yuriw_NOSPAM@.hotmail.com> wrote in message
> news:7Mnxc.68469$yx3.34214@.newssvr29.news.prodigy.com...
> Hello,
> I am using the function below to get some values form database.
> However for RecordCount it always returns -1.
> Any clues hot to fix it?
> Thx
> YuriW
> Function RunSQL (sConnection_String, sSQL_QUERY)
> Dim db_object
> Dim sSQL_string
> 'connection_string = "DSN=Magnetic;UID=laurel;PWD=uklever"
> sSQL_string = sSQL_QUERY
> ' Create the conection object.
> Set db_object = CreateObject("ADODB.Connection")
> ' or use this method if a DSN entry was created.
> db_object.Open(sConnection_String)
> ' Get the recordset returned from a select query.
> Set recordset = db_object.Execute(sSQL_string)
> ' Display the results of the query.
> sOut = recordset.RecordCount
> RunSQL = sOut
> ' Close the database connection.
> db_object.Close
> Set db_object = Nothing
> End Function
>|||In "Display the results of the query" you should iterate through recordset
with MoveFirst/MoveNext. Add counter into this cycle
dim counter
counter = 0
rs.MoveFirst
while not rs.EOF
... display record
counter = counter + 1
rs.MoveNext
wend
'here counter contains number of records
//--
Regards,
Vassiliev V. V.
http://www-sharp.com -
Scripting/HTA/.Net Framework IDE
"Yuri Weinstein (HotMail)" <yuriw_NOSPAM@.hotmail.com> '?/'' ?
'' '?: news:7Mnxc.68469$yx3.34214@.newssvr29.news.prodigy.com...
Hello,
I am using the function below to get some values form database.
However for RecordCount it always returns -1.
Any clues hot to fix it?
Thx
YuriW
Function RunSQL (sConnection_String, sSQL_QUERY)
Dim db_object
Dim sSQL_string
'connection_string = "DSN=Magnetic;UID=laurel;PWD=uklever"
sSQL_string = sSQL_QUERY
' Create the conection object.
Set db_object = CreateObject("ADODB.Connection")
' or use this method if a DSN entry was created.
db_object.Open(sConnection_String)
' Get the recordset returned from a select query.
Set recordset = db_object.Execute(sSQL_string)
' Display the results of the query.
sOut = recordset.RecordCount
RunSQL = sOut
' Close the database connection.
db_object.Close
Set db_object = Nothing
End Function

RecordCount -1

Hello,
I am using the function below to get some values form database.
However for RecordCount it always returns -1.
Any clues hot to fix it?
Thx
YuriW
Function RunSQL (sConnection_String, sSQL_QUERY)
Dim db_object
Dim sSQL_string
'connection_string = "DSN=Magnetic;UID=laurel;PWD=uklever"
sSQL_string = sSQL_QUERY
' Create the conection object.
Set db_object = CreateObject("ADODB.Connection")
' or use this method if a DSN entry was created.
db_object.Open(sConnection_String)
' Get the recordset returned from a select query.
Set recordset = db_object.Execute(sSQL_string)
' Display the results of the query.
sOut = recordset.RecordCount
RunSQL = sOut
' Close the database connection.
db_object.Close
Set db_object = Nothing
End Function
http://www.aspfaq.com/2193
http://www.aspfaq.com/
(Reverse address to reply.)
"Yuri Weinstein (HotMail)" <yuriw_NOSPAM@.hotmail.com> wrote in message
news:7Mnxc.68469$yx3.34214@.newssvr29.news.prodigy. com...
Hello,
I am using the function below to get some values form database.
However for RecordCount it always returns -1.
Any clues hot to fix it?
Thx
YuriW
Function RunSQL (sConnection_String, sSQL_QUERY)
Dim db_object
Dim sSQL_string
'connection_string = "DSN=Magnetic;UID=laurel;PWD=uklever"
sSQL_string = sSQL_QUERY
' Create the conection object.
Set db_object = CreateObject("ADODB.Connection")
' or use this method if a DSN entry was created.
db_object.Open(sConnection_String)
' Get the recordset returned from a select query.
Set recordset = db_object.Execute(sSQL_string)
' Display the results of the query.
sOut = recordset.RecordCount
RunSQL = sOut
' Close the database connection.
db_object.Close
Set db_object = Nothing
End Function
|||Thanks you. I am still not clear how to change the code in order to fix it?
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:eyU6tjYTEHA.3580@.TK2MSFTNGP09.phx.gbl...
> http://www.aspfaq.com/2193
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "Yuri Weinstein (HotMail)" <yuriw_NOSPAM@.hotmail.com> wrote in message
> news:7Mnxc.68469$yx3.34214@.newssvr29.news.prodigy. com...
> Hello,
> I am using the function below to get some values form database.
> However for RecordCount it always returns -1.
> Any clues hot to fix it?
> Thx
> YuriW
> Function RunSQL (sConnection_String, sSQL_QUERY)
> Dim db_object
> Dim sSQL_string
> 'connection_string = "DSN=Magnetic;UID=laurel;PWD=uklever"
> sSQL_string = sSQL_QUERY
> ' Create the conection object.
> Set db_object = CreateObject("ADODB.Connection")
> ' or use this method if a DSN entry was created.
> db_object.Open(sConnection_String)
> ' Get the recordset returned from a select query.
> Set recordset = db_object.Execute(sSQL_string)
> ' Display the results of the query.
> sOut = recordset.RecordCount
> RunSQL = sOut
> ' Close the database connection.
> db_object.Close
> Set db_object = Nothing
> End Function
>
|||Maybe you need to look at the article again?
http://www.aspfaq.com/
(Reverse address to reply.)
"Yuri Weinstein (HotMail)" <yuriw_NOSPAM@.hotmail.com> wrote in message
news:dnoxc.68491$iR3.59055@.newssvr29.news.prodigy. com...
> Thanks you. I am still not clear how to change the code in order to fix
it?
>
> "Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
> news:eyU6tjYTEHA.3580@.TK2MSFTNGP09.phx.gbl...
>
|||Recordcount is not supported with the default forward-only cursor. You can try to set the type of cursor before you excute your SQL code.
"Yuri Weinstein (HotMail)" <yuriw_NOSPAM@.hotmail.com> wrote in message news:7Mnxc.68469$yx3.34214@.newssvr29.news.prodigy. com...
Hello,
I am using the function below to get some values form database.
However for RecordCount it always returns -1.
Any clues hot to fix it?
Thx
YuriW
Function RunSQL (sConnection_String, sSQL_QUERY)
Dim db_object
Dim sSQL_string
'connection_string = "DSN=Magnetic;UID=laurel;PWD=uklever"
sSQL_string = sSQL_QUERY
' Create the conection object.
Set db_object = CreateObject("ADODB.Connection")
' or use this method if a DSN entry was created.
db_object.Open(sConnection_String)
' Get the recordset returned from a select query.
Set recordset = db_object.Execute(sSQL_string)
' Display the results of the query.
sOut = recordset.RecordCount
RunSQL = sOut
' Close the database connection.
db_object.Close
Set db_object = Nothing
End Function
|||Got it, thx!
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:eyU6tjYTEHA.3580@.TK2MSFTNGP09.phx.gbl...
> http://www.aspfaq.com/2193
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "Yuri Weinstein (HotMail)" <yuriw_NOSPAM@.hotmail.com> wrote in message
> news:7Mnxc.68469$yx3.34214@.newssvr29.news.prodigy. com...
> Hello,
> I am using the function below to get some values form database.
> However for RecordCount it always returns -1.
> Any clues hot to fix it?
> Thx
> YuriW
> Function RunSQL (sConnection_String, sSQL_QUERY)
> Dim db_object
> Dim sSQL_string
> 'connection_string = "DSN=Magnetic;UID=laurel;PWD=uklever"
> sSQL_string = sSQL_QUERY
> ' Create the conection object.
> Set db_object = CreateObject("ADODB.Connection")
> ' or use this method if a DSN entry was created.
> db_object.Open(sConnection_String)
> ' Get the recordset returned from a select query.
> Set recordset = db_object.Execute(sSQL_string)
> ' Display the results of the query.
> sOut = recordset.RecordCount
> RunSQL = sOut
> ' Close the database connection.
> db_object.Close
> Set db_object = Nothing
> End Function
>
|||In "Display the results of the query" you should iterate through recordset
with MoveFirst/MoveNext. Add counter into this cycle
dim counter
counter = 0
rs.MoveFirst
while not rs.EOF
... display record
counter = counter + 1
rs.MoveNext
wend
'here counter contains number of records
//--
Regards,
Vassiliev V. V.
http://www-sharp.com -
Scripting/HTA/.Net Framework IDE
"Yuri Weinstein (HotMail)" <yuriw_NOSPAM@.hotmail.com> ??/?? ?
?? ??: news:7Mnxc.68469$yx3.34214@.newssvr29.news.prodigy. com...
Hello,
I am using the function below to get some values form database.
However for RecordCount it always returns -1.
Any clues hot to fix it?
Thx
YuriW
Function RunSQL (sConnection_String, sSQL_QUERY)
Dim db_object
Dim sSQL_string
'connection_string = "DSN=Magnetic;UID=laurel;PWD=uklever"
sSQL_string = sSQL_QUERY
' Create the conection object.
Set db_object = CreateObject("ADODB.Connection")
' or use this method if a DSN entry was created.
db_object.Open(sConnection_String)
' Get the recordset returned from a select query.
Set recordset = db_object.Execute(sSQL_string)
' Display the results of the query.
sOut = recordset.RecordCount
RunSQL = sOut
' Close the database connection.
db_object.Close
Set db_object = Nothing
End Function

RecordCount

I've got to count the rocrds of this query (SELECT DISTINCT lm.idlm, lm.descrizione FROM lm, grf, saf, cfc WHERE cfc.idlm = lm.idlm AND cfc.idsaf = saf.idsaf AND cfc.idgrf = grf.idgrf) but i can't use the function RecordCount of Visual Basic... how can I do?
Please Help ME!why can't you use the recordcount property? be more specific.|||in order to use recordcount, you have to use the proper (client-side)cursor. I dont remember what it is right off..
use an expensive one then work your way down ;)

recordcount

I've got to count the rocrds of this query (SELECT DISTINCT lm.idlm, lm.descrizione FROM lm, grf, saf, cfc WHERE cfc.idlm = lm.idlm AND cfc.idsaf = saf.idsaf AND cfc.idgrf = grf.idgrf) but i can't use the function RecordCount of Visual Basic... how can I do?
Please Help ME!Hello,

whats about

SELECT COUNT(DISTINCT lm.idlm, lm.descrizione)
FROM lm, grf, saf, cfc WHERE cfc.idlm = lm.idlm AND cfc.idsaf = saf.idsaf AND cfc.idgrf = grf.idgrf


?

Hope that helps ?

Manfred Peter
(Alligator Company)
http://www.alligatorsql.com