473,672 Members | 2,497 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 6141
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
1471
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
1829
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
2164
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
4411
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
7681
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
2273
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
2633
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
3020
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
6470
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
8485
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
8828
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
8605
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,...
1
6238
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
5704
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
4417
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2819
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
2
2062
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1816
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.