Hi, The below 3 table join with select works fine. -
-
SQLQuery="Select top 5 L.accept,etc,etc, "
-
-
SQLQuery= SQLQuery & "FROM tblAppsLoginDatabaseBySmo L INNER JOIN tblAppsProfilesDatabaseBySmo P ON L.UserId = P.UserId "
-
SQLQuery= SQLQuery & " inner join tblWatches T ON P.UserId = T.WatchingUserID "
-
SQLQuery= SQLQuery & " and p.userid in (Select WatchingUserID from tblWatches where WatchedProfileID <>0 )"
-
-
SQLQuery= SQLQuery & " order by NEWID() "
I am returning 5 random users who are watching other users. See previous topic. http://bytes.com/topic/sql-server/an...es#post3768064
What I want is to only return the users who are watching more than 10 other users. I presume it's count(WatchedPr ofileID)>5 but if I try to add it here I get errors. I have tried with having count etc. - SQLQuery= SQLQuery & " and p.userid in (Select WatchingUserID from tblWatches where WatchedProfileID <>0 and (count(WatchedProfileID) >10))"
It might be a syntax thing I am doing wrong.
When I join the tblWatches to the main query
Any pointers would be great
Thanks in advance
Richard
2 1022 Rabbit 12,516
Recognized Expert Moderator MVP
You need to join it to a query that does a count of people watched by person watching.
Hi, Thanks, This is how i did it in the end. - (Select WatchingUserID from tblWatches where WatchedProfileID <>0 group by WatchingUserID HAVING COUNT(*) > 5)"
Thanks
Richard
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Ralph Freshour |
last post by:
I'm not sure the follow multiple table query is the right way to do
what I need to do although it seems to be working:
$php_SQL = "SELECT * ".
"FROM basics, personal, photos ".
"WHERE basics.member_name = personal.member_name ".
"AND basics.member_name = photos.member_name ".
"AND basics.account_creation_date >= DATE_SUB(NOW(),
INTERVAL...
|
by: Sue |
last post by:
On code-behind page:
(attributes set programatically for each of these elements)
linkbutton added to tablecell
textbox added to tablecell
tablecells added to tablerow
tablerow added to table (table.ID is TestTable)
On .aspx page:
<HeaderTemplate>
<asp:Table ID="TestTable" runat="Server" />
</HeaderTemplate>
|
by: Gianfranco |
last post by:
Hi
I got a problem with 2 tables.
I have a table, say A, with x records, coming from a make table query
and a table, say B, with y records, coming from another make table
query. I need to join and link the 2 tables, so that the first record
of A is associated with the fist record of B, the second record of A
is associated (I mean,in the same...
|
by: PMB |
last post by:
Thank you in advance for any and all assistance.
I'm trying to use a make table query to pull the last transactionID, so I
can use an append query to reset the transactionID to the next sequential
number. My problem is, the make table query is taking all the
TransactionID's and putting them in the new table.
Is there a way to take the...
|
by: aps786 |
last post by:
Hi,
There is a table where I store ipaddress and user who logged in from that IP. I have a query to findout all ipaddresses, from where diff users had made request.
stat
------------
ip
userid
I wrote query like this
| |
by: Bob |
last post by:
Hi all,
I want to incorporate several types of different rankings to a Make
Table Query I have then use the rank for calculations.
I want to calculate rankings based on how much each client has in a
portfolio, so lets say there are 4 portfolios, so each client would
have 4 rankings, dependant upon how much they had in each portfolio...
|
by: ielamrani |
last post by:
Hi,
I am trying to run a make table query and it's giving me the following error:
"Numeric Field Overflow"
Here the query:
SELECT tblPCRAFees.,
tblPCRAFees.,
tblPCRAFees.,
IIf(="SSSG" Or ="QUADA" Or ="169","50","35.70") AS Charge,
|
by: sam15024 |
last post by:
Hi I am newbie, can you please help me to create this query through vba
SELECT .Field1, .Field2, .Field3, .Field4, .Field5
FROM 010710_pri
GROUP BY .Field1, .Field2, .Field3, .Field4, .Field5
HAVING (((Count(*))=1));
I want to create a make table query.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |