Showing posts with label single. Show all posts
Showing posts with label single. Show all posts

Friday, March 23, 2012

Problem with a SQL Statement

I have three tables:
Products Table
PID
PName
PType
Linking Table
LID
PID
CID
Customers Table
CID
CName
CPhone
I am trying to make a single statement that will give me all the customers
that haven't bought a certain single product so i can make a list of people
to contact regarding that product.
Any help or suggestions would be greatly appreciated... I just can't seem to
get this one right.
@.SELECT c.CName, c.Cphone
FROM Customers c
LEFT OUTER JOIN
(Linking l
INNER JOIN Products p
ON l.pid = c.pid)
ON c.CID = l.CID
AND p.PName = 'some product name'
WHERE l.CID IS NULL
or
SELECT c.CName, c.Cphone
FROM Customers c
WHERE NOT EXISTS(
SELECT NULL
FROM Linking l
INNER JOIN Products p
ON l.pid = c.pid
WHERE c.CID = l.CID
AND p.PName = 'some product name')
Jacco Schalkwijk
SQL Server MVP
"Atley" <atley_1@.hotmail.com> wrote in message
news:%23n997$C6DHA.2696@.TK2MSFTNGP09.phx.gbl...
quote:

> I have three tables:
> Products Table
> PID
> PName
> PType
> Linking Table
> LID
> PID
> CID
> Customers Table
> CID
> CName
> CPhone
>
> I am trying to make a single statement that will give me all the customers
> that haven't bought a certain single product so i can make a list of

people
quote:

> to contact regarding that product.
> Any help or suggestions would be greatly appreciated... I just can't seem

to
quote:

> get this one right.
> @.
>
>
|||--The following will show records of all customers who haven't bought item
number 901.
SELECT * FROM Customers A
WHERE NOT EXISTS
(SELECT * FROM Link
WHERE CID = A.CID AND PID = 901)
Rohtash Kapoor
http://www.sqlmantra.com
"Atley" <atley_1@.hotmail.com> wrote in message
news:%23n997$C6DHA.2696@.TK2MSFTNGP09.phx.gbl...
quote:

> I have three tables:
> Products Table
> PID
> PName
> PType
> Linking Table
> LID
> PID
> CID
> Customers Table
> CID
> CName
> CPhone
>
> I am trying to make a single statement that will give me all the customers
> that haven't bought a certain single product so i can make a list of

people
quote:

> to contact regarding that product.
> Any help or suggestions would be greatly appreciated... I just can't seem

to
quote:

> get this one right.
> @.
>
>
|||I see you have got an answer.
But please next time, do not cross-post to every newsgroup you find. This is
not a Windows Server problem, nor a datamining or datawarehouse problem.
Regards,
Kristofer Gafvert - IIS MVP
Reply to newsgroup only. Remove NEWS if you must reply by email, but please
do not.
www.ilopia.com - FAQ and Tutorials for Windows Server 2003
"Atley" <atley_1@.hotmail.com> wrote in message
news:%23n997$C6DHA.2696@.TK2MSFTNGP09.phx.gbl...
quote:

> I have three tables:
> Products Table
> PID
> PName
> PType
> Linking Table
> LID
> PID
> CID
> Customers Table
> CID
> CName
> CPhone
>
> I am trying to make a single statement that will give me all the customers
> that haven't bought a certain single product so i can make a list of

people
quote:

> to contact regarding that product.
> Any help or suggestions would be greatly appreciated... I just can't seem

to
quote:

> get this one right.
> @.
>
>
sql

Problem with a SQL Statement

I have three tables:
Products Table
PID
PName
PType
Linking Table
LID
PID
CID
Customers Table
CID
CName
CPhone
I am trying to make a single statement that will give me all the customers
that haven't bought a certain single product so i can make a list of people
to contact regarding that product.
Any help or suggestions would be greatly appreciated... I just can't seem to
get this one right.
@.SELECT c.CName, c.Cphone
FROM Customers c
LEFT OUTER JOIN
(Linking l
INNER JOIN Products p
ON l.pid = c.pid)
ON c.CID = l.CID
AND p.PName = 'some product name'
WHERE l.CID IS NULL
or
SELECT c.CName, c.Cphone
FROM Customers c
WHERE NOT EXISTS(
SELECT NULL
FROM Linking l
INNER JOIN Products p
ON l.pid = c.pid
WHERE c.CID = l.CID
AND p.PName = 'some product name')
--
Jacco Schalkwijk
SQL Server MVP
"Atley" <atley_1@.hotmail.com> wrote in message
news:%23n997$C6DHA.2696@.TK2MSFTNGP09.phx.gbl...
> I have three tables:
> Products Table
> PID
> PName
> PType
> Linking Table
> LID
> PID
> CID
> Customers Table
> CID
> CName
> CPhone
>
> I am trying to make a single statement that will give me all the customers
> that haven't bought a certain single product so i can make a list of
people
> to contact regarding that product.
> Any help or suggestions would be greatly appreciated... I just can't seem
to
> get this one right.
> @.
>
>|||--The following will show records of all customers who haven't bought item
number 901.
SELECT * FROM Customers A
WHERE NOT EXISTS
(SELECT * FROM Link
WHERE CID = A.CID AND PID = 901)
--
Rohtash Kapoor
http://www.sqlmantra.com
"Atley" <atley_1@.hotmail.com> wrote in message
news:%23n997$C6DHA.2696@.TK2MSFTNGP09.phx.gbl...
> I have three tables:
> Products Table
> PID
> PName
> PType
> Linking Table
> LID
> PID
> CID
> Customers Table
> CID
> CName
> CPhone
>
> I am trying to make a single statement that will give me all the customers
> that haven't bought a certain single product so i can make a list of
people
> to contact regarding that product.
> Any help or suggestions would be greatly appreciated... I just can't seem
to
> get this one right.
> @.
>
>|||I see you have got an answer.
But please next time, do not cross-post to every newsgroup you find. This is
not a Windows Server problem, nor a datamining or datawarehouse problem.
--
Regards,
Kristofer Gafvert - IIS MVP
Reply to newsgroup only. Remove NEWS if you must reply by email, but please
do not.
www.ilopia.com - FAQ and Tutorials for Windows Server 2003
"Atley" <atley_1@.hotmail.com> wrote in message
news:%23n997$C6DHA.2696@.TK2MSFTNGP09.phx.gbl...
> I have three tables:
> Products Table
> PID
> PName
> PType
> Linking Table
> LID
> PID
> CID
> Customers Table
> CID
> CName
> CPhone
>
> I am trying to make a single statement that will give me all the customers
> that haven't bought a certain single product so i can make a list of
people
> to contact regarding that product.
> Any help or suggestions would be greatly appreciated... I just can't seem
to
> get this one right.
> @.
>
>

Saturday, February 25, 2012

Problem using MSDE

Hi
I have been trying to use the MSDE

info
MSDE installed
sa (has a password)
tried with both mixed and single mode change in registry and later on install
SQL server icon running in the system tray
several reboots and reinstalls over days

I can create a web page that connects to a DB and says connected and disconnected
but I cannot get any data displayed?

I have tried the portal starter Kit and it cannot find the sql server on the install
If I try to do it remotely it wants me to run stuff in a query analyser and some .sql files
but MSDE does not have an interface as such

I am very confused and I just want the system to connect to the db or for the portal to work

Please help

Thank you all in advanceCan you connect to your MSDE through the Server Explorer in Studio?

If so, then you can create a Database Project which will give you a platform from which to interact with your MSDE instance.