Hi, I want to create a sql query but don't know if this is possible with
mysql.
The Query should do the following:
Select all db entries from table in which entry a is smaller than the number
(count) of all db entries with criteria x from another table.
Thx for your help!
Benjamin Dickgießer 3 7550
On Sun, 16 Nov 2003 12:08:19 -0000, "Benjamin Dickgießer"
<Be******@dickg iesser.net> wrote: Hi, I want to create a sql query but don't know if this is possible with mysql.
Please don't multipost, you've sent an identical post to alt.php.sql. If you
want to post to multiple groups, then crosspost (one message, with multiple
groups in the Newsgroup header).
The Query should do the following: Select all db entries from table in which entry a is smaller than the number (count) of all db entries with criteria x from another table.
In most databases, you'd just use a subquery:
SELECT *
FROM table2
WHERE a < (SELECT COUNT(*)
FROM table1
WHERE 'criteria x')
But MySQL doesn't support subqueries.
So you're probably better off executing the subquery to get the count, and
then doing a second query against the first table to compare with entry 'a'.
Assuming that your 'criteria x' is independent of the outer select, though.
--
Andy Hassall (an**@andyh.co. uk) icq(5747695) ( http://www.andyh.co.uk)
Space: disk usage analysis tool ( http://www.andyhsoftware.co.uk/space)
4.1 does.
"Andy Hassall" <an**@andyh.co. uk> wrote in message
news:7i******** *************** *********@4ax.c om... On Sun, 16 Nov 2003 12:08:19 -0000, "Benjamin Dickgießer" <Be******@dickg iesser.net> wrote:
Hi, I want to create a sql query but don't know if this is possible with mysql. Please don't multipost, you've sent an identical post to alt.php.sql. If
you want to post to multiple groups, then crosspost (one message, with
multiple groups in the Newsgroup header).
The Query should do the following: Select all db entries from table in which entry a is smaller than the
number(count) of all db entries with criteria x from another table. In most databases, you'd just use a subquery:
SELECT * FROM table2 WHERE a < (SELECT COUNT(*) FROM table1 WHERE 'criteria x')
But MySQL doesn't support subqueries.
So you're probably better off executing the subquery to get the count,
and then doing a second query against the first table to compare with entry
'a'. Assuming that your 'criteria x' is independent of the outer select,
though. -- Andy Hassall (an**@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk) Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
On Sun, 16 Nov 2003 16:15:01 GMT, "john" <my******@john. com> wrote: "Andy Hassall" <an**@andyh.co. uk> wrote in message news:7i******* *************** **********@4ax. com... But MySQL doesn't support subqueries.
4.1 does.
4.1 is still alpha; when it's released, then it'll be fair to say MySQL
supports subqueries.
--
Andy Hassall (an**@andyh.co. uk) icq(5747695) ( http://www.andyh.co.uk)
Space: disk usage analysis tool ( http://www.andyhsoftware.co.uk/space) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Gordon |
last post by:
I have 2 tables t and t1. In this case, t1 is a copy of t. I want to
delete rows from t1 based on criteria on the t table and a relationship
between t ad t1 (in this case the id column). In the results below, I
would think that the delete should have deleted row 1 {1 5 me) and not
row 3 (1 5 they) when I run this statement
delete t1 from t, t1 where t.id = t1.id and t.id=1 and t.name = 'me';
Any ideas on why row 2 is deleted?
|
by: Lenz Grimmer |
last post by:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
MySQL 4.0.14, a new version of the popular Open Source/Free Software
Database, has been released. It is now available in source and binary form
for a number of platforms from our download pages at
http://www.mysql.com/downloads/ and mirror sites.
|
by: red85 |
last post by:
hello i have mysql 4.1 with win2000 SP3, i know that it is only an
alpha and i don't know if someone else has already posted this
problem:
when i execute this sql
UPDATE tableX SET fieldX=valueX
WHERE id IN (SELECT tX.id FROM tableX AS tX WHERE tX.fieldY=valueY AND
filedZ=valueZ);
|
by: Philip Stoev |
last post by:
Hi all,
Please tell me if any of this makes sense. Any pointers to relevant
projects/articles will be much appreciated.
Philip Stoev
http://www.stoev.org/pivot/manifest.htm
===================================
|
by: Mike Chirico |
last post by:
Interesting Things to Know about MySQL
Mike Chirico (mchirico@users.sourceforge.net)
Copyright (GPU Free Documentation License) 2004
Last Updated: Mon Jun 7 10:37:28 EDT 2004
The latest version of this document can be found at:
http://prdownloads.sourceforge.net/souptonuts/README_mysql.txt?download
| |
by: jlee |
last post by:
I'm pretty much a newbie on mysql, and I need some help.
I am running mysql Ver 12.22 Distrib 4.0.24, for portbld-freebsd5.4
(i386) on a server hosting an active website.
The site's developer uses his own php shopping cart to receive customer
orders.
The configuration was done via cPanel with no external modifications -
which produced no protests when built, ran and connected with no
|
by: Fred |
last post by:
Hello,
Our website is currently developed in ASP/Mysql 4.
The dedicated servers on which it is currently hosted arrive at saturation.
Here is their configuration:
- 1 server PIV 2,8Ghz 1GB RAM with IIS 5 on Windows 2000
- 1 server Bi-xeon 3Ghz, 512 MB with MySQL 4 on Windows 2003
The website makes approximately 10.000.000 of pages seen and 310.000
|
by: Ciaran |
last post by:
Hi All,
Is it faster to have mySql look up as much data as possible in one
complex query or to have php do all the complex processing and submit
lots of simple queries to the mysql database?
Cheers,
Ciarán
|
by: Atli |
last post by:
This is an easy to digest 12 step guide on basics of using MySQL. It's a great refresher for those who need it and it work's great for first time MySQL users.
Anyone should be able to get through this without much trouble. Programming knowledge is not required.
Index
What is SQL?
Why MySQL?
Installing MySQL.
Using the MySQL command line interface
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |