On Mon, Jun 20, 2011 at 3:49 PM, Karl DeSaulniers wrote:
> Try..
>
> $posts_sql = "SELECT posts.post_store, posts.post_content, posts.post_date,
> posts.post_by, users.user_id, users.user_name FROM posts LEFT JOIN users ON
> osts.post_by = users.user_id WHERE posts.post_store = "
> .mysql_real_esc
Try..
$posts_sql = "SELECT posts.post_store, posts.post_content,
posts.post_date, posts.post_by, users.user_id, users.user_name FROM
posts LEFT JOIN users ON osts.post_by = users.user_id WHERE
posts.post_store = " .mysql_real_escape_string($_GET['id'])." ORDER
BY posts.post_date DESC";
Chris,
Try this:
http://dev.mysql.com/doc/refman/5.0/en/order-by-optimization.html
On 20 June 2011 20:56, Chris Stinemetz wrote:
> I have the bellow sql query. What is the correct way to add ORDER BY
> posts.post_date DESC
>
> I would like to add it to the end of my query, but I am just gettin
Hey friend.
The problem is here:
( SELECT `reference`, `organization` FROM `ministry_profiles`...
In a subselect, you must select just one column. You are selecting two
"reference" and "organization".
If you really need both, so you must do two subselects: one for
"reference" and another for
I haven't tried the union method the query i have is actually
quite a bit more complicated than just a simple select * from a
single table, so while it may work, it might take a while to write it
if I am reading all this right.
But yes, the ifnull() method works just fine. Thanks for yo
You shouldn't have to do that. the IFNULL() handles all that. If the item is
null, it returns an emptry string ''. If it's blank/empty, it returns an empty
string. This is just used for the comparison = ''. This determines if it's
empty or null and if so, returns 'ZZ',
In case the blank is a null or is really a blank:
select * from blank where tchar_10 is not null and tchar_10 != ''
union all
select * from blank where tchar_10 is null or tchar_10 = ''
- Dave
On 12/21/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
wrote:
This is a little weird looking, but should
This is a little weird looking, but should do the job. Remember that items in
your 'order by' can be manipulated conditionally. In this case, I'm looking
for NULL as well as '' (empty) and changing it to something that should come
after all your normal alphabetical values, but it doesn't chang
This is a little weird looking, but should do the job. Remember that items in
your 'order by' can be manipulated conditionally. In this case, I'm looking
for NULL as well as '' (empty) and changing it to something that should come
after all your normal alphabetical values, but it doesn't chang
What about a union? Does mySql 4.0.x support it?
select * from blank where tchar_10 != ''
union all
select * from blank where tchar_10 = ''
- Dave
On 12/21/06, Naintara <[EMAIL PROTECTED]> wrote:
Depending on your MySQL version you could use a subquery by combining the
two queries you men
Unfortunately, I'm on 4.0.x so sub-queries are out. And yeah, I
should get my host to upgrade but we both work for the government
so that isn't happening. ;-)
Any other thoughts.
--
Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada Community College
www.wncc.edu
7
Depending on your MySQL version you could use a subquery by combining the
two queries you mentioned, for a fairly straight-forward query.
http://dev.mysql.com/tech-resources/articles/4.1/subqueries.html
http://mysqld.active-venture.com/Subqueries.html
You could read about optimizing subqueries fo
Yes!
Just separate your columns with commas!
Check out the proper sintax!!
-Original Message-
From: Ron Piggott (PHP) [mailto:[EMAIL PROTECTED]
Sent: Miércoles, 18 de Octubre de 2006 06:58 p.m.
To: PHP DB
Subject: [PHP-DB] ORDER BY
Is it possible to do an ORDER BY column_a column_b AS
Ron Piggott (PHP) wrote:
Is it possible to do an ORDER BY column_a column_b ASC ? IE Can you
specify two columns to cause the output to be displayed in a specific
order? Ron
Yes (a quick search would have told you this too).
It's best to specify the order for each one:
order by column_a a
[EMAIL PROTECTED] wrote:
Hi,
I have a MySQL varchar column which I wish to display. Most of the
entries are numbers eg 1, 2, 3 etc etc. But some are numbers and letters
eg 34A, 34B, 35A.
When I display the column I am able to sort by number using the "order
by column_name+0" command, as in:
$result
Shaun wrote:
I have a table in my database called Users. This table has (among others)
two columns called Location and Name. Location will be either 1, 2, 3, or 4.
How can I produce a query that groups the result into Location and then for
each Location order the User by Name?
Learn SQL, please.
Just a shot in the dark.. it may be wrong, but try it out..
"SELECT avg(rating) AS avgrating FROM ratings WHERE parent_id = '$id' ORDER
BY avgrating DESC LIMIT 10"
try that out.. should work.
metin
At 04:06 PM 6/18/2003 -0400, chris wrote:
I've done a google search, but most of the results are
Thank you all for the Tip ! It work´s fine now !! :)
Gus
- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, March 20, 2002 10:32 AM
Subject: Re: [PHP-DB] order by problem
> On Wed, 20 Mar 2002 [E
On Wed, 20 Mar 2002 [EMAIL PROTECTED] wrote:
You have your ctrlnumber field defined as varchar. If you define
ctrlnumber as number, you could also use
SELECT max(ctrlnumber) FROM table WHERE id=14;
Cheers
Urosh
> Hello All,
>
> I´m having a 'problem' that I dont know how to resolve. The proble
Make CtrlNumber a numeric value instead of a string.
=C=
*
* Cal Evans
* Techno-Mage
* http://www.calevans.com
*
- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 20, 2002 7:21 AM
Subject: [PHP-DB] order by problem
> Hello All,
>
> I´m having
>Maybe I'm slow...I'm trying to decipher what you're trying to do. Show us your table
>layout
>Show us your search criteria and code
>Show us a dump of your table so we can see what the data look like
ahhh give the chap a break, this is 4th (or so) posting. he thinks we're all
wonderful! Let's
Maybe I'm slow...
I'm trying to decipher what you're trying to do.
Show us your table layout
Show us your search criteria and code
Show us a dump of your table so we can see what the data look like
-Original Message-
From: Chris Payne [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October
Hi Andrius,
try "order by date desc"
Steve
At 9:12 PM -0700 11/9/01, Andrius Jakutis wrote:
>Ok, here is the question:
>
>I write to order by date "Order by date".
>
>So, it output's something like this:
>
>2001 08 01
>2001 08 02
>2001 08 03
>
>What if I want to order by date, but not from the o
- Original Message -
From: Andrius Jakutis <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 12, 2001 12:12 PM
Subject: [PHP-DB] order by question
> Ok, here is the question:
>
> I write to order by date "Order by date".
>
> So, it output's something like this:
>
>
Hi Scott,
RTFM. Anyway: '... ORDER BY Date DESC' will do the job for you.
Greetinx,
Mike
Michael Rudel
- Web-Development, Systemadministration -
Besuchen Sie uns am 20. und 21. August 2001 auf der
online-marketing-düsseldorf in Halle 1 Stand E 16
_
you can use order by date DESC
for descending
or
order by date
for ascending
nice to see a PHP-Database question in here ;-)
Dave
-Original Message-
From: Scott Chapman [mailto:[EMAIL PROTECTED]]
Sent: 09 August 2001 10:50
To: [EMAIL PROTECTED]
Subject: [PHP-DB] order by date
Hi
try the RSORT (reserve sort) function???
Andreas Iwanowski wrote:
>
> Hello,
> i have a table where unix timestamps are inserted when adding a record.
>
> If i read out the table data, i want to order it by unixtime ( the name of
> the filed where the timestamp is )
>
> He orders it by unixti
Thank you
"Steve Brett" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
>
> > -Original Message-
> > From: Andreas Iwanowski [mailto:[EMAIL PROTECTED]]
> > Sent: 12 July 2001 16:09
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-DB] Order by unix times
Vielen Dank
"Michael Rudel" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
02bb01c10ae5$38128190$[EMAIL PROTECTED]">news:02bb01c10ae5$38128190$[EMAIL PROTECTED]...
> ORDER BY unixtime DESC
>
> (it default orders by asc, not desc)
>
> Greetinx,
> Mike
>
> Michael Rudel
> - Web-Development, Systemadmi
> -Original Message-
> From: Andreas Iwanowski [mailto:[EMAIL PROTECTED]]
> Sent: 12 July 2001 16:09
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Order by unix timestamp
>
>
> How can i fix the problem that the records are ordered by unixtime,
> beginning with the newest record ?
orde
ORDER BY unixtime DESC
(it default orders by asc, not desc)
Greetinx,
Mike
Michael Rudel
- Web-Development, Systemadministration -
Besuchen Sie uns am 20. und 21. August 2001 auf der
online-marketing-düsseldorf in Halle 1 Stand E 16
___
>question:
>
>Do any of you knwo how to correctly sort output from a query that contains
>"Umlaut" like " Ä Ö Ü" etc. so that it looks like this:
>
>A
>Ä
>B
>C
>D
>
>O
>Ö
>P
>R
>
>
>and not like MYSQL does it now with the ORDER BY function, which puts all
>the "Umlaut" at the end like this
32 matches
Mail list logo