473,394 Members | 1,717 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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 6125
heres the query im trying (well one variant):

$result = mysql_query("SELECT 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("SELECT 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("SELECT * 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******@hotmail.com wrote:
monomaniac21 wrote:
heres the query im trying (well one variant):

$result = mysql_query("SELECT 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("SELECT * 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******@hotmail.com wrote:
>>monomaniac21 wrote:

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

$result = mysql_query("SELECT 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("SELECT * 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*******@attglobal.net
==================
Jul 13 '06 #5

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

Similar topics

1
by: don | last post by:
Ref Dvd Title Location ---------------------------------------- 62 Pilates; Austin Binder 1 63 Yoga; Kripalu Binder 1 64 Yoga; Workout ...
6
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...
1
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
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...
5
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,...
8
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...
6
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...
1
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...
3
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
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...
0
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...
0
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...

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.