Showing posts with label clever. Show all posts
Showing posts with label clever. Show all posts

Friday, February 10, 2012

Clever Query

MEMBER_ID FRIEND_ID
285 1
285 2
285 3
Member 285 has 3 friends. Table is set out as above.
Members 1,2 and 3 have their own friends.
MEMBER_ID FRIEND_ID
1 286
1 1654
1 556
2 56465
2 87864
3 564564
3 5454
3 4588
3 4545
So from the above we can see that the Friends of Friends count would be
9.
Using the above how could I write a query that gave me the answer 9 for
the member_id 285?
I thank clever person who can help.This is a multi-part message in MIME format.
--=_NextPart_000_0A1D_01C6D648.8662A940
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
It's not really clear what you are trying to accomplish here, but for a ='wag':
SELECT count(1)
FROM Table1 t1
JOIN Table2 t2
ON t1.Friend_ID =3D t2.Member_ID
-- Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience. Most experience comes from bad judgment. - Anonymous
<gurdipv@.gmail.com> wrote in message =news:1158075642.788596.64550@.e63g2000cwd.googlegroups.com...
> MEMBER_ID FRIEND_ID
> 285 1
> 285 2
> 285 3
> > Member 285 has 3 friends. Table is set out as above.
> > Members 1,2 and 3 have their own friends.
> > MEMBER_ID FRIEND_ID
> 1 286
> 1 1654
> 1 556
> 2 56465
> 2 87864
> 3 564564
> 3 5454
> 3 4588
> 3 4545
> > > So from the above we can see that the Friends of Friends count would =be
> 9.
> > Using the above how could I write a query that gave me the answer 9 =for
> the member_id 285?
> > I thank clever person who can help.
>
--=_NextPart_000_0A1D_01C6D648.8662A940
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&

It's not really clear what you are =trying to accomplish here, but for a 'wag':
SELECT count(1)
FROM Table1 t1
JOIN Table2 =t2
=ON t1.Friend_ID =3D t2.Member_ID
-- Arnie Rowland, Ph.D.Westwood Consulting, Inc
Most good judgment comes from =experience. Most experience comes from bad judgment. - Anonymous
wrote in message news:1158075642.788596.64550@.e63g2000cwd.googlegroups.com=...> =MEMBER_ID FRIEND_ID> 285 1> 285 2> 285 3> > =Member 285 has 3 friends. Table is set out as above.> > Members 1,2 =and 3 have their own friends.> > MEMBER_ID FRIEND_ID> 1 286> 1 1654> 1 556> 2 56465> 2 87864> =3 564564> 3 5454> 3 4588> 3 4545> > => So from the above we can see that the Friends of Friends count would =be> 9.> > Using the above how could I write a query that gave =me the answer 9 for> the member_id 285?> > I thank clever =person who can help.>

--=_NextPart_000_0A1D_01C6D648.8662A940--

Clever Query

MEMBER_ID FRIEND_ID
285 1
285 2
285 3
Member 285 has 3 friends. Table is set out as above.
Members 1,2 and 3 have their own friends.
MEMBER_ID FRIEND_ID
1 286
1 1654
1 556
2 56465
2 87864
3 564564
3 5454
3 4588
3 4545
So from the above we can see that the Friends of Friends count would be
9.
Using the above how could I write a query that gave me the answer 9 for
the member_id 285?
I thank clever person who can help.It's not really clear what you are trying to accomplish here, but for a 'wag
':
SELECT count(1)
FROM Table1 t1
JOIN Table2 t2
ON t1.Friend_ID = t2.Member_ID
--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
<gurdipv@.gmail.com> wrote in message news:1158075642.788596.64550@.e63g2000cwd.googlegroups.c
om...
> MEMBER_ID FRIEND_ID
> 285 1
> 285 2
> 285 3
>
> Member 285 has 3 friends. Table is set out as above.
>
> Members 1,2 and 3 have their own friends.
>
> MEMBER_ID FRIEND_ID
> 1 286
> 1 1654
> 1 556
> 2 56465
> 2 87864
> 3 564564
> 3 5454
> 3 4588
> 3 4545
>
>
> So from the above we can see that the Friends of Friends count would be
> 9.
>
> Using the above how could I write a query that gave me the answer 9 for
> the member_id 285?
>
> I thank clever person who can help.
>

clever date to find most recent .bak file

Say I have 3 .bak files named:

jamesB.bak, jamesG.bak, jamesW.bak

Is there a clever way to find out which is the most recent of these
backup files?? Using sql query analyzer preferably...jamesd wrote:

Quote:

Originally Posted by

Say I have 3 .bak files named:
>
jamesB.bak, jamesG.bak, jamesW.bak
>
Is there a clever way to find out which is the most recent of these
backup files?? Using sql query analyzer preferably...


USE msdb;
GO
SELECT * FROM dbo.backupset;

SELECT * FROM dbo.backupfile;
SELECT * FROM dbo.backupfilegroup;
SELECT * FROM dbo.backupmediafamily;
SELECT * FROM dbo.backupmediaset;|||Hi Steve,
I don't think that will work, because I do not have the original msdb
database. I only have 3 .bak files (from another machine) and a virgin
database server (sql 2000).|||"jamesd" <jamesd@.ring4freedom.comwrote in message
news:1160592663.337156.238310@.k70g2000cwa.googlegr oups.com...

Quote:

Originally Posted by

Hi Steve,
I don't think that will work, because I do not have the original msdb
database. I only have 3 .bak files (from another machine) and a virgin
database server (sql 2000).
>


xp_cmdshell with DIR and then read it into a table.|||Please assume that all 3 files have the same ntfs modified date. I am
looking for a way to examine each .bak file to read its metadata and
see which one is most recent.

If I restore each .bak file is there a way to see the date of the
backup?

Greg D. Moore (Strider) wrote:

Quote:

Originally Posted by

"jamesd" <jamesd@.ring4freedom.comwrote in message
news:1160592663.337156.238310@.k70g2000cwa.googlegr oups.com...

Quote:

Originally Posted by

Hi Steve,
I don't think that will work, because I do not have the original msdb
database. I only have 3 .bak files (from another machine) and a virgin
database server (sql 2000).


>
xp_cmdshell with DIR and then read it into a table.