Pieter,
If you use LIKE '%abc%' then this will match 'abc' 'abcs' 'ABC' 'DABCE'
'DABC' and 'ABCD'. It will not match 'AB'. In your case it may work
better if you validate the words before you run your SELECT statement or
make your fields more specific. For example, instead of a field called
descr
I've used a lot of Oracle, some MS Access and I'm newish to MySQL. I
found it easy to write an abstraction layer for Ms Access and Oracle
despite their different approaches to some important things. I find
MySQL very sparse by comparison and I spend more time working round the
db than working with
John,
I was intrigued with the given solution so I tried this and here's a
version I found to work:
Table x1 has fields uid, uname, pid (parent's id)
select parent.uname, count( child.uname) as ChildCount
from x1 as parent left join x1 as child on ( parent.uID=child.pid)
group by parent.uName
Trevor,
Why not try simplify it to 2 fields and remove most of the validation
code? If that works, then you can binary add/delete code until it fails.
BTW 'Red' I guess only works on certain mail clients, but not mine, so
sorry if I missed something obvious.
Regards,
Andy.
Trevor Morrison wrote:
As Victoria says, you can't. However I agree that this syntax is useless
in many real-world situations. You are not the only one who finds this
behaviour annoying. It's about time someone made SQL a 21st century
language...
Miroslav I. wrote:
Hallo
suppose you have a table with great
Hi,
1) I was investigating the unix_timestamp routine in mysql (version
3.23.46-nt) and for some reason the unix epoch (1-1-1970) was returned
with a value of -3600. Then, as you can see, it suddenly corrected
itself. I can't replicate this error, but it caused me to shudder.
Attached is the
Keith,
You're on the right track. But instead of 2 tables, pretend you have
three. 1) Home Teams, 2) Schedule 3) Opponent Teams. In reality tables 1
and 3 are the same table, but you mus't get confused between using
'Teams' as Home Teams and Teams as Opponents. In the same way as you
named columns
Eli,
Use = for exact matches and LIKE for partial matches using a wild card
e.g. WHERE column_name LIKE ab% will match 'ab', 'abc' and 'ABC' but
not 'acb'.
Regards,
Andy
eli wrote:
Hi,
I have a question about using LIKE or equal.
I mean, comparing two strings with exact coincidence,
- that's the scary bit.
- Andy
Keith C. Ivey wrote:
On 7 Aug 2003 at 15:27, Andy Jackman wrote:
1) I was investigating the unix_timestamp routine in mysql (version
3.23.46-nt) and for some reason the unix epoch (1-1-1970) was returned
with a value of -3600.
That's what I'd expect
David,
Gah. That's what I was hoping to avoid. It's like writing BASIC and
having to leave yourself room...
Yes, but unlike a basic program of 1 lines (heh, remember that!) you
only need to leave room for n questions. If n is small - no problem,
even if you have to 'renumber'. If n is
Aaron,
It sounds like the join has duplicates on both sides. If you join a-b
where a is unique (like a primary key) then you will get count(b)
records (where b is the rows that match a). Or if b is unique then you
will get count(a) records. However if neither a or b is unique you get
count(a) *
David,
Firstly, to answer your question I don't know of a MySQL function that
may allow you to sort indirectly by the contents of a field - there are
many many functions and some of them are very specialised, and if you
ever move to another db all those great little functions may not be
there.
Hi,
I'm using v 3.23.46-nt and the C API.
The manual says under 'Changes in release 3.20.17' that:
Change FROM_DAYS() and WEEKDAY() to also take a full TIMESTAMP or DATETIME as
argument. Before they only took a number of type MMDD or YYMMDD.
I'm confused since this doesn't seem to be the
Mattias,
Your 'blueprint' table looks good.
This where itemID corresponds to a item in the master table and the
componentID ALSO referes to items in the Master table???
Correct. This allows 'recursive' components. For example, Item 3
contains components 1,3,4 and component 4 is actually made
David,
Is it possible to cause the client to wait by the server issuing a
SLEEP? What if the client just disconnectes and immeadiately reconnects?
Say you use a sleep of 2 seconds. If your server can accept 100
connections at once then 1 client can issue 100 login attempts and wait
2 seconds for
Dave,
The documentation has several examples. Here's a function we use. Are
you having a particular difficulty?
Regards,
Andy.
snip
MYSQL *aDb = NULL;
int xConnect()
{
#define MYSQL_HOST 192.168.103.112 // or host name
#define MYSQL_DBfoodb // database
Prem,
I had this problem and adding the library 'z' (whatever that is) helped.
Try putting -lz at the end of your compile line.
Regards,
Andy.
Prem Soman wrote:
i am using Linux 6.2(Zoot) and MySql 2.23.36and found the following error while
compiling the C program using mysql APIcc -o test
Mike,
Is the field days meant to be the number of days until expdate?
(This is implied by the number 14 you gave). If so, you shouldn't be
storing the days value in the database at all (the reason being it
causes exactly the problem you seem to have).
Instead you should store only expdate and
Mattias,
It may not be such a good idea to store the 6 items in 1 record. An
alternative structure is one table with Item ID and Name and another
with Item Id and Component Id, both of which point back to item id in
the first table. This avoids having to know how many components there
are and
KB,
1) There's an interesting virus alert attached to your message.
2) what front end tools should i think of using for dataentry clients
IMHO, the answer is 'the web'. Is there a good reason why you don't want
to do that? I realise that JSP is an obvious choice and perhaps like me
you think it
Gary,
The if() function often allows you to replace a union query. For example
this may work for you - watch the LIMIT it operates AFTER the sort so
your sort needs to put the records which you want at the front:
SELECT user_id, username, last_login, if(last_team = 380, 1, 2) as
SortOrder FROM
Donald,
I've done this before - it wasn't nice. The best solution I came up with
was to store the kits in the item table as though they were items. So
the structure is: (Lets call a 'Product' an Item or a Kit depending on
the 'prod_type')
PRODUCT KIT CONTENTSPRODUCT
MaFai,
But the ip address would change too
If this system is running on a LAN why would it be a problem to change
the DNS or are you trying to connect other clients (e.g. from the web?)
- Andy
MaFai wrote:
Hello, mysql,
We have 1 master and salve in my lan.
If the master failed,coze the
Kalle,
The usual way to do this is to create the table with the 2 real fields
and then use a query to 'create' the sum field at run time. For example
assume you have this table:
create table my_table (
field_1 int(9),
field_2 int(9)
);
then you can write this query:
SELECT
Hi,
I want to get any one of a number of rows that matches some criteria and
update it so that it is marked as 'mine'. How can I do this safely?
Given something like this table:
create table tbl_new (
t_value varchar(16) primary key not null,
dt_used datetime,
l_pid
There a bit of discussion like this in the user comments of the manual:
http://www.mysql.com/doc/en/example-Maximum-row.html
- Andy
Venelin Arnaoudov wrote:
I would copy all the records (_email_, max(version)) to a new table,
drop the old one and then rename the new one
Regards,
Venelin
Hi,
I'm new to mySql. I've got a table with an integer field defined like
this:
l_start_wait int(9) not null
I inserted a value into the table using mysql command line client with:
Insert into tbl_wait_list values(12345678);
When I use mysql_fetch_row() to retrieve the column values I am
27 matches
Mail list logo