I'm working on a web page in php with a mysql DB. I'm trying to list
some products with some other information but I'm having trouble tying
them together. Is there a way to force a very specific order to be
returned? What I need to be able to do is have a query like
"select * from products where prodID = 'thing1' or prodID = 'thing2'
or prodID = 'thing3'...
but I need it to come back in that EXACT order, product matching
thing1 first thing2 second and so on.
Any ideas?
Thanks,
Tim 3 2473
Odarr wrote: I'm working on a web page in php with a mysql DB. I'm trying to list some products with some other information but I'm having trouble tying them together. Is there a way to force a very specific order to be returned? What I need to be able to do is have a query like
"select * from products where prodID = 'thing1' or prodID = 'thing2' or prodID = 'thing3'...
but I need it to come back in that EXACT order, product matching thing1 first thing2 second and so on.
use:
order by fieldname
at the end of your query.
Instead of names, use integer id values in the field which you want to
use for ordering, that way you can easily deside that 'thing1' = 1,
'thing2' = 2, etc, and ordering them is simple and fast.
Odarr wrote: I'm working on a web page in php with a mysql DB. I'm trying to list some products with some other information but I'm having trouble tying them together. Is there a way to force a very specific order to be returned? What I need to be able to do is have a query like
"select * from products where prodID = 'thing1' or prodID = 'thing2' or prodID = 'thing3'...
but I need it to come back in that EXACT order, product matching thing1 first thing2 second and so on.
use:
order by fieldname
at the end of your query.
Instead of names, use integer id values in the field which you want to
use for ordering, that way you can easily deside that 'thing1' = 1,
'thing2' = 2, etc, and ordering them is simple and fast.
Odarr wrote: I'm working on a web page in php with a mysql DB. I'm trying to list some products with some other information but I'm having trouble tying them together. Is there a way to force a very specific order to be returned? What I need to be able to do is have a query like
"select * from products where prodID = 'thing1' or prodID = 'thing2' or prodID = 'thing3'...
but I need it to come back in that EXACT order, product matching thing1 first thing2 second and so on.
use:
order by fieldname
at the end of your query.
Instead of names, use integer id values in the field which you want to
use for ordering, that way you can easily deside that 'thing1' = 1,
'thing2' = 2, etc, and ordering them is simple and fast. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: vk |
last post by:
I have a situation where I have 3 frames. The first frame is dynamic
and contains javascript variables for use throughout the frameset page
and the other frames.
Everything works fine...except...
|
by: tracy |
last post by:
I have a complex query (16 table join) that until five days ago took 30
sec to run. It now takes eight hours. I restored a backup of the
database from five days ago and the query plans are...
|
by: Clark Spencer |
last post by:
I have built a small integration app using VS .NET 2003 that extracts
orderinformation from a 'webshop'. Extracting the orderinformation works fine.
Appending the order elements in the...
|
by: Jeronimo Bertran |
last post by:
I have a DataGrid that gets filled based on a filter which is defined by
the values that the user selects on several controls. When the page
postbacks after changing the selection on the filter...
|
by: comp.lang.php |
last post by:
I have a form that when you click the "Generate Report" submit button,
it will force download a CSV file, required for this project.
On the very same page you also have a "Search" submit button,...
|
by: Oliver Block |
last post by:
Hi,
I wrote a style to display a web page. Nothing special so far.:)
Now I want to force the User Agents to rotate the content by 90°. That is
necessary in order to display all data in an...
|
by: Veeru71 |
last post by:
Hi,
1) Is it possible to force the join order of the tables in a query
(similar to "hints" in Sybase, etc) ?
For Example, I am joining 3 tables - A,B & C in my SELECT stmt, and I
would like...
|
by: MarkusJNZ |
last post by:
Hi, I have two different applications running on 2003 both in two
different vitrual directories. One application runs on the .NET
framework 1.1 whilst the other runs on 2.0.
If I change the...
|
by: beary |
last post by:
Is it possible to use an order by statement but force mysql to start with a different entry than the first one?
eg. column is "class", which has the possible values "8maths", "10maths", "admaths",...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
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...
|
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: 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,...
|
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...
| |