473,734 Members | 2,647 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

mysql selecting distinct in one collumn but retrieving all the the other cols too

hi!

is it possible to do the aforementioned query - selecting only distinct
in 1 col but retrieving all other cols at the same time.

regards

marc

Jul 12 '06 #1
4 6146
heres the query im trying (well one variant):

$result = mysql_query("SE LECT name, id FROM tblproducts WHERE category
= '$category_get' & name = DISTINCT ORDER BY name ASC LIMIT 0,8");

also tried: "select distinct name, id.." to no avail...
monomaniac21 wrote:
hi!

is it possible to do the aforementioned query - selecting only distinct
in 1 col but retrieving all other cols at the same time.

regards

marc
Jul 12 '06 #2

monomaniac21 wrote:
heres the query im trying (well one variant):

$result = mysql_query("SE LECT name, id FROM tblproducts WHERE category
= '$category_get' & name = DISTINCT ORDER BY name ASC LIMIT 0,8");

also tried: "select distinct name, id.." to no avail...
monomaniac21 wrote:
hi!

is it possible to do the aforementioned query - selecting only distinct
in 1 col but retrieving all other cols at the same time.

regards

marc
what do you mean exactly?? you can do:
$result = mysql_query("SE LECT * FROM tblproducts WHERE category
= '$category_get' & name = DISTINCT ORDER BY name ASC LIMIT 0,8");

that will select all the fields from each row that matches your where
clause..

Flamer.

Jul 12 '06 #3
you cant do this query:

SELECT * FROM tblproducts WHERE name = DISTINCT ORDER BY date_added
DESC, name ASC LIMIT 0,8

mysql wont allow it. by distinct im referring to unique values not the
string value equal to distinct.

can anyone help me with a query that can do this?
flamer di******@hotmai l.com wrote:
monomaniac21 wrote:
heres the query im trying (well one variant):

$result = mysql_query("SE LECT name, id FROM tblproducts WHERE category
= '$category_get' & name = DISTINCT ORDER BY name ASC LIMIT 0,8");

also tried: "select distinct name, id.." to no avail...
monomaniac21 wrote:
hi!
>
is it possible to do the aforementioned query - selecting only distinct
in 1 col but retrieving all other cols at the same time.
>
regards
>
marc

what do you mean exactly?? you can do:
$result = mysql_query("SE LECT * FROM tblproducts WHERE category
= '$category_get' & name = DISTINCT ORDER BY name ASC LIMIT 0,8");

that will select all the fields from each row that matches your where
clause..

Flamer.
Jul 13 '06 #4
monomaniac21 wrote:
you cant do this query:

SELECT * FROM tblproducts WHERE name = DISTINCT ORDER BY date_added
DESC, name ASC LIMIT 0,8

mysql wont allow it. by distinct im referring to unique values not the
string value equal to distinct.

can anyone help me with a query that can do this?
flamer di******@hotmai l.com wrote:
>>monomaniac2 1 wrote:

>>>heres the query im trying (well one variant):

$result = mysql_query("SE LECT name, id FROM tblproducts WHERE category
= '$category_get' & name = DISTINCT ORDER BY name ASC LIMIT 0,8");

also tried: "select distinct name, id.." to no avail...
monomaniac 21 wrote:

hi!

is it possible to do the aforementioned query - selecting only distinct
in 1 col but retrieving all other cols at the same time.

regards

marc

what do you mean exactly?? you can do:
$result = mysql_query("SE LECT * FROM tblproducts WHERE category
= '$category_get' & name = DISTINCT ORDER BY name ASC LIMIT 0,8");

that will select all the fields from each row that matches your where
clause..

Flamer.

Maybe you should ask MySQL questions in a group such as
comp.databases. mysql - where the MySQL gurus hang out?

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jul 13 '06 #5

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

Similar topics

1
1478
by: don | last post by:
Ref Dvd Title Location ---------------------------------------- 62 Pilates; Austin Binder 1 63 Yoga; Kripalu Binder 1 64 Yoga; Workout Binder 1 93 The Sopranos Binder 1 94 The Sopranos Binder 2 95 The Sopranos Binder 3
6
1830
by: Matik | last post by:
Hello all, I've following problem. Please forgive me not posting script, but I think it won't help anyway. I've a table, which is quite big (over 5 milions records). Now, this table contains one field (varchar), which contains some data in the chain. Now, there is a view on this table, to present the data to user. The
1
2165
by: monomaniac21 | last post by:
Hi all Can anyone tell me how you can query mysql for all unique entries into a particular table collumn. Ive checked the manual but had no luck! Kind regards marc
2
4417
by: monomaniac21 | last post by:
Hi all Using MySQL can anyone tell me how to most efficiently insert a collumn in 'table1' retrieve the id from this record and insert mutliple records into 'table2' with a collumn for the id in 'table1' which links the two recordsets
5
7688
by: msch-prv | last post by:
Hi, I am trying to tie a SQLDataSource control to MySQL without success. The connection string works ok with an ObjectDataSource. (Native asp.net 2.0 MySQL dll loaded in /bin) For some reason, the compiler believes an SQL db is being accessed ("An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does...
8
2276
by: 1987dan | last post by:
I have made a collumn 7 rows deep where i click an arrow at the top of the column and then a red counter appears in the bottom cell of the collumn. I wish to make this collumn like a connect 4 collumn in the sense that every time i click the arrow and a red counter image replaces a white counter image. And these red Counters build on top of each other.
6
2640
by: jej1216 | last post by:
I am trying to put together a PHP search page in which the user can select none, one, two, or three fields to search, and then the results php will build the SQL with dynamic where caluses to reflect the fields chosen. The first page, where they select the search fields and submit: <?php $db = mysql_connect("localhost", "root", "yeahright"); if (!$db) { die('Could not connect:'.mysql_error);
1
3024
by: TechnoAtif | last post by:
Hi to all. I have got a form containing of checkboxes along with other items. I have simply no clue as to (i) how to make entry for those checkbox data into the mysql table . I mean : what query to put for creating field corresponding to checkboxes. Create table arc(status ---?) status is the array for checkboxes. what should be the data type and its length. (II)How to post data from the checkboxes correctly into the database on submit....
3
6474
by: ctrap | last post by:
Hi Everyone, Here's my situation: I'm making a website for an employment agency, there is a page where potential employees can visit and "pre-register". When the submit button is hit the information is supposed to be stored in a MySQL database. Number one, when I hit submit nothing happens. I have to manually execute the PHP script. When the PHP script is executed it inserts a blank record into the database and I get my Thank You...
0
8776
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,...
0
9310
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...
0
9182
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
8186
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...
1
6735
isladogs
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...
0
6031
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();...
0
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2724
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2180
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.