Hi,
Please can someone help me with this. It is not returning any results but it should.
[PHP]SELECT * FROM listings WHERE (category = 'Weddings' or category2 = 'Weddings' or category3 = 'Weddings') AND (subcategory = 'DJs Discos and Karaoke' or subcategory2 = 'DJs Discos and Karaoke' or subcategory3 = 'DJs Discos and Karaoke') AND status = '1' ORDER BY ('premium', 'sdate')[/PHP]
Cheers,
Adam
6 1182
This is a MySQL question, so I'll move the thread to that forum. - moderator
When 'premium' and 'sdate' are table columns, you don't specify any quotes around column names (back-ticks if you want to), so should sort by
Ronald
Hi,
Please can someone help me with this. It is not returning any results but it should.
[PHP]SELECT * FROM listings WHERE (category = 'Weddings' or category2 = 'Weddings' or category3 = 'Weddings') AND (subcategory = 'DJs Discos and Karaoke' or subcategory2 = 'DJs Discos and Karaoke' or subcategory3 = 'DJs Discos and Karaoke') AND status = '1' ORDER BY ('premium', 'sdate')[/PHP]
Cheers,
Adam
Hi,
It's difficult to tell without seeing the data involved. Could it be a case sensitivity issue?
Try converting the fields to lowercase: -
SELECT * FROM listings WHERE 'weddings' IN(lower(category), lower(category2), lower(category3)) AND 'djs discos and karaoke' IN (lower(subcategory), lower(subcategory2), lower(subcategory3)) AND status = '1' ORDER BY ('premium', 'sdate')
-
I have also modified the code sligtly but that shouldn't have anmy impact on it's own.
Cheers
nathj
No, it is definitely the ORDER BY.
Ronald
No, it is definitely the ORDER BY.
Ronald
Hi,
Show my own lack of understanding here but how would an 'ORDER BY' affect the output in terms of what is retrieved? I thought it simply ordered the results byt the fields specified.
nathj
It was the ORDER BY that was causing the problem. It should have been e.g. ORDER BY premium ASC, sdate ASC
Cheers,
Adam
Hi,
Show my own lack of understanding here but how would an 'ORDER BY' affect the output in terms of what is retrieved? I thought it simply ordered the results byt the fields specified.
nathj
nathj: Not when it is incorrectly specified. See Adam's answer: it was the ORDER BY. Adam: glad this is solved. See you next time around.
ROnald
Sign in to post your reply or Sign up for a free account.
Similar topics
by: serge |
last post by:
/*
This is a long post. You can paste the whole message
in the SQL Query Analyzer.
I have a scenario where there are records
with values pointing to wrong records and I need to fix them
using an...
|
by: WindAndWaves |
last post by:
Can anyone tell me what is wrong with the goto command. I noticed it is one
of those NEVER USE.
I can understand that it may lead to confusing code, but I often use it like
this:
is this...
|
by: Daniel Rudy |
last post by:
What is wrong with this program? When I try to compile it, I get the
following error. Compiler is gcc on FreeBSD.
strata:/home/dcrudy/c 1055 $$$ ->cc -g -oe6-3 e6-3.c
e6-3.c: In function...
|
by: Brian Basquille |
last post by:
Hello all,
Bit of a change of pace now. As opposed to the typical questions regarding
my Air Hockey game, am also working on a Photo Album which uses an Access
Database to store information...
|
by: THY |
last post by:
can anyone tell me what's wrong with this statement ?
cn.execute("update table set data = 'test'")
the asp.net keep telling me syntax error in update statement ...
help me please ...
|
by: noridotjabi |
last post by:
Okay. I'm quite embarased to be asking this but I cannot seem to get
files to work. I don't know what the problem is. Is there something
wrong with this: (file related)
#include <stdio.h>...
|
by: Xah Lee |
last post by:
in March, i posted a essay “What is Expressiveness in a Computer
Language”, archived at:
http://xahlee.org/perl-python/what_is_expresiveness.html
I was informed then that there is a academic...
|
by: Ryan |
last post by:
{"POINTID":77902,"MAPID":762,"LONG":-122.21654892,"LAT":"37.1834331019","CITY":"Boulder
Creek","STATE":"CA","DIST":5745.4}
I get an "invalid label" error...
I'm kinda new to this. Thanks!
|
by: robert maas, see http://tinyurl.com/uh3t |
last post by:
Here's the source:
#include <stdio.h>
#include <errno.h>
main () {
char* str = "9999999999";
long long int llin; char* endptr; /* Set by strtoll */
int nch;
errno = 0;
llin = strtoll(str,...
|
by: CTG |
last post by:
"update set UPDATE-FLAG=false, UPDATE-DT= '10/09/2007
4:09:59 PM' WHERE ICCID='I1' "
UPDATE_FLAG is a YES/NO
ICCID is TEXT
I have tried YES, NO as well but still fails,
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |