473,670 Members | 2,401 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MySQL query in products system

Hi there

I have a products site with a mysql backend.
I have two tables:
1 with series,
1 with products belonging to certain series.

Series looks like:
- id
- kind
- active
- name

Products looks like:
- id
- series_id
- name

Since i'm kind of a newbie, i can't figure out the
following:
I need the query to get all product-information on products that are
in a series where 'series.Active = 1' and 'series.kind = 543' (e.g.
543)
Products have to be limited (e.g. 20)
output sort of has to be:

series.name - products.name - products.id

I hope this is enough information.

Thanks!

Frizzle.

Jul 17 '05 #1
2 1478
frizzle (ph********@gma il.com) decided we needed to hear...
Hi there

I have a products site with a mysql backend.
I have two tables:
1 with series,
1 with products belonging to certain series.

Series looks like:
- id
- kind
- active
- name

Products looks like:
- id
- series_id
- name

Since i'm kind of a newbie, i can't figure out the
following:
I need the query to get all product-information on products that are
in a series where 'series.Active = 1' and 'series.kind = 543' (e.g.
543)
Products have to be limited (e.g. 20)
output sort of has to be:

series.name - products.name - products.id

I hope this is enough information.

Thanks!

Frizzle.


You pretty much defined the query yourself already...

select s.name, p.name, p.id
from series s, products p
where s.active = 1 and s.kind = 543 and s.id = p.series_id
order by s.name, p.name
limit 20

Remove/change the order by as required.
--
Dave <da**@REMOVEbun dook.com>
(Remove REMOVE for email address)
Jul 17 '05 #2
Great!
Thanks a bunch!!!!

Greetings Frizzle!
(lots to learn :) )

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
11754
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a table in MySQL with the path & filename to the image. I have successfully uploaded and performed an update query on the database, but the problem I have is I cannot retain the primary key field in a variable which is then used in a SQL update...
0
1068
by: David | last post by:
Hi, I have a MySQL database and in the front-end software I am using to Run MySQL, I have created a query on the tables which runs in the front-end, similar to the MS Access query grid. I now wish to pull this query on-line using .asp, but I seem to have found out that I can only pull data from tables in MySQL ? The query I have is :
3
1973
by: Gregory.Spencer | last post by:
Hello there, I'm looking for a tool that does for MySQL Db's what Access does for Jet DB's. Therefore provides a nice gui to speedup certain tasks and produce entitiy relationship diagrams. Is there a market leader in this field? Do people have recommendations? I'm actually looking into using Visio for creating my diagrams but it
39
8394
by: Mairhtin O'Feannag | last post by:
Hello, I have a client (customer) who asked the question : "Why would I buy and use UDB, when MySql is free?" I had to say I was stunned. I have no experience with MySql, so I was left sort of stammering and sputtering, and managed to pull out something I heard a couple of years back - that there was no real transaction safety in MySql. In flight transactions could be lost.
14
6593
by: dottty | last post by:
Hi, i have a table that has the following fields: id, name, dept, pay 1, John, Sales, 4000 2, Peter, HR, 5000 etc. How do i count how many people there are in each dept with an sql query? I find this surprisingly difficult, given the fact that i can sum the total
2
2252
by: basestring | last post by:
Hi I am busy now for many hours without luck I have a database and when I use PHP to add date to it, it works only one time when i want to add the next data, It doesn't work. but i don't get any errors??? see my code: $query = "INSERT INTO products VALUES ('$typedata','$pro_code_ourdata','$pronum','$proname','$prodetails','$facnum','$picturedata','$price','$probox','$proquantity')"; mysql_query($query);
4
1487
by: SBmx | last post by:
hello I need help building a SELECT query... well, two queries actually i have three tables: products / fields id, name, type, country producttypes / fields: id, name countries / fields: id, name
11
1590
by: rich | last post by:
I'm having a tough time figuring out which of these two options are best. This is a matter of processing my data in PHP, vs MySQL. Usually that's a no brainer, but I have a couple gotchyas here and would love any and all opinions here. I'm going to make this as short and simple as I can... This is for an e-commerce site with very high traffic, and the choice will probably not be based on speed, but which is more scalable. I need this...
0
8471
marktang
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...
0
8907
Oralloy
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8817
jinu1996
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8593
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8663
tracyyun
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7423
agi2029
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...
0
5687
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1799
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.