802 Posted Topics

Member Avatar for MDanz

I don't see any errors in the structure, so presumably it's in the data. Please show them.

Member Avatar for griswolf
0
138
Member Avatar for loopylou8

What are "3 PK's"? You can avoid trouble by setting foreign keys in the bookings table. These make sure that you cannot enter a booking with invalid IDs. And set a unique key on the driver/car combination to avoid double bookings. Like that: [CODE]create table bookings (driverID integer not null, …

Member Avatar for loopylou8
0
165
Member Avatar for roachae

If Mysql isn't the best, as you say, how would you solve this in another DBMS?

Member Avatar for roachae
0
161
Member Avatar for felix001

Also keep in mind that MySQL doesn't have a regex replace function. You might find the pattern, but you cannot replace it. You would have to use a user defined function - which might be the easiest way to tackle it, anyway, if you really have to solve it within …

Member Avatar for smantscheff
0
127
Member Avatar for danny4444

I don't understand what you're aiming at. Please provide some sample data and the desired result.

Member Avatar for danny4444
0
8K
Member Avatar for derozza

You are applying the between operator on a character field. Therefore it does not compare dates, but literal strings. To compare dates on your data you have either to convert them to date fields or to reverse the sequence of the elements. Try: [CODE]SELECT approval_date FROM itemdetail WHERE concat(substr(approval_date,6,4),'/',substr(approval_date),4,2),'/',substr(approval_date,1,2)) BETWEEN …

Member Avatar for smantscheff
0
107
Member Avatar for prithvi.web

I don't see how your problem refers to mysql. In mysql you can search for date ranges with a where clause like "mydate between '2011-02-01' and '2011-03-01'.

Member Avatar for prithvi.web
0
180
Member Avatar for _martinh

Use the ifnull function in your update clause: [CODE]update mytable set channel=ifnull(identifychannel(centre_code, company_class, stock_type),channel)[/CODE]

Member Avatar for smantscheff
0
79
Member Avatar for mrhankey

Any concatenation with NULL results in NULL. Therefore you have to use the ifnull function: [CODE]SELECT CONCAT(ifnull(properties.PropertyRef,''), ' ', ifnull(properties.SaleType,'') ... [/CODE]

Member Avatar for mrhankey
0
2K
Member Avatar for altarek

The english spell I with a capital "I". And they use punctuation marks. It is not quite clear what you want: the person entries which appear more than once in per_db? Or the person entries where the number of occurences in per_db is the same as the value of the …

Member Avatar for smantscheff
0
123
Member Avatar for Xintare

I would prefer a solution without the priority field and with only one occurence of the search term: [CODE]select a.locationID, ifnull(alternateName,locationName) as theName, countryCode from locations l left join alternatenames a on l.locationID = a.locationID having theName like '$term%'; [/CODE]

Member Avatar for smantscheff
0
151
Member Avatar for robertw

[ICODE]drop table if exists accounts; create table accounts (id integer, account integer, fiscalyear integer, openingbalance float ); insert into accounts values ('1','1202','2011','1122.00'), ('2','1210','2011','0.0'), ('3','1920','2011','1212.33'); drop table if exists transactions; create table transactions (id integer, account integer, date date, amount float); insert into transactions values ('1','1210','2010-01-01','23.00'), ('2','1210','2010-01-23','566'), ('3','1920','2010-01-21','456'), ('4','1202','2010-01-14','956'); select a.account, …

Member Avatar for smantscheff
0
130
Member Avatar for shinsengumi

I don't know the C interface but assume it's the same as PHP's. If so, you could use the [ICODE]mysql_num_rows(res)[/ICODE] result, or you could first check the row count by [ICODE]select count(*) from table3 where ID = %d[/ICODE]

Member Avatar for smantscheff
0
333
Member Avatar for Vanquish39

Do you mean: just the med_names and nothing else? You can of couse select them directly from the items table. But this is not what you mean, I suppose. What do you mean instead? If you want to show some kind of relationship between items and pharmacies you do need …

Member Avatar for drjohn
0
171
Member Avatar for nasablast

Show the table defnition. In which field are your data stored? Presumably an integer field. Alter it to a time field.

Member Avatar for nasablast
0
58
Member Avatar for bbinais

$tbl_name is not a valid table name. Please quote the complete error message and show the CREATE TABLE statment for that table.

Member Avatar for smantscheff
0
62
Member Avatar for laura203

If the auditlog table has a primary auto_increment key, you can insert the records into a new table by selecting all fields except the auto_increment field for which you insert a NULL. Example: [CODE]insert into newtable (id, field2, field3, field4) select NULL, field2, field3, field4 from oldtable; [/CODE] This leads …

Member Avatar for laura203
0
154
Member Avatar for Borzoi

You could also use a VPN between the clients and your server so that the database cannot be compromised via the Internet.

Member Avatar for Borzoi
0
172
Member Avatar for mrhankey

Make sure that TaskDueDate contains exactly the date value you want. Or, better, alter it to a date field instead of a datetime field.

Member Avatar for d5e5
0
174
Member Avatar for akndsandhu

[url]http://www.webdevelopersnotes.com/tutorials/sql/index.php3[/url] This is just a randomly picked link of the google result for "mysql primer".

Member Avatar for jlego
0
109
Member Avatar for michael1999

If this is an mysql problem, you can check it by logging into your mysql server with the mysql command line client with the same parameters as your website scripts. Then enter "show status" at the mysql command line. If there are a lot of processes running, your script does …

Member Avatar for michael1999
0
94
Member Avatar for andydeans

Study the LEFT JOIN syntax and semantics. That's what you need. [url]http://dev.mysql.com/doc/refman/5.0/en/join.html[/url]

Member Avatar for andydeans
-1
113
Member Avatar for tmano

This is called screen grabbing, and there are lots of useful techniques for it. Use wget to grab the whole site and a couple of grep and sed scripts or PHP with preg_match or other regular expressions to extract the relevant content to CSV. Then load the CSV tables into …

Member Avatar for smantscheff
0
110
Member Avatar for siddhesh.kerkar

Your where clause is in effect the same as [ICODE]facility_name = 'Parking' or facility_name = 'AC'[/ICODE] But what you need is [ICODE]facility_name = 'Parking' [U]and[/U] facility_name = 'AC'[/ICODE]

Member Avatar for siddhesh.kerkar
0
95
Member Avatar for Ignatius88

First of all make sure that your set definition is complete. As of now, it lacks "Biography" and "Music". Afterwards go along those lines: [ICODE]drop table if exists movie_genre; create table movie_genre (id integer ,title text ,genre varchar(255) ); drop table if exists movie_plot; create table movie_plot (id integer ,title …

Member Avatar for Ignatius88
0
146
Member Avatar for tutorim

Noob there, please write in English. 1) Use the MySQL INSERT statement. 2) Use the MySQL LOAD DATA statement. If this does not answer your questions, as I suppose, try to be more specific.

Member Avatar for smantscheff
0
210
Member Avatar for BaSk

It is not clear what your problem is. Submit some test data and the results you would like to have. I only noticed that the in the where clause [ICODE](DateSignup BETWEEN '2010-11-1' AND '2010-12-1' AND PaymentCycle = "1") OR ((DateSignup BETWEEN '2010-11-1' AND '2010-12-1' AND PaymentCycle = "12")[/ICODE] you are …

Member Avatar for BaSk
0
246
Member Avatar for ubi_ct83

Did you ever think of using Google? [url]http://www.developer.com/java/data/article.php/3417381[/url]

Member Avatar for smantscheff
0
165
Member Avatar for ggbard

A query can validate and still have a result with no rows. Please show your code sample.

Member Avatar for ggbard
0
170
Member Avatar for AliHurworth

Your query misses a closing bracket ) For debugging purposes add a routine which shows the mysql error messages if a query has no result. Use the functions mysql_errno() and mysql_error().

Member Avatar for AliHurworth
0
259
Member Avatar for Teejayypee

Learn, read, study. It is the easiest way. If you run into a problem doing your homework come back for help.

Member Avatar for smantscheff
0
98
Member Avatar for MDanz

Use plain brackets () instead of curly brackets {} Add a semicolon ; after each statement (after "INNODB")

Member Avatar for pritaeas
0
135
Member Avatar for artie77

There is no database application which you could "open". MySQL does not come with a GUI. MySQL server usually runs as a service. You can connect to the server with various command line client programs like mysql, mysqladmin, mysqldump etc. which you find in the mysql/bin folder.

Member Avatar for dodgeitorelse
0
118
Member Avatar for exception

Get yourself a mysql command line client (in the MySQL installation package). Start it with the parameters you also use in ODBC. It might give you more precise error messages. A common pitfall is the format of the password. If you are using an old database server and a new …

Member Avatar for smantscheff
0
92
Member Avatar for rahulephp

How can you have an index on "Group_by(clean_modelno, publishercategory) BTREE[/*]" - an index on a group by clause? This is possible? What are the results of "EXPLAIN your_query" ?

Member Avatar for smantscheff
0
710
Member Avatar for himmat.m4
Member Avatar for smantscheff
0
130
Member Avatar for Orthodox73

Always provide a full test case. [ICODE]drop table if exists results; create table results (user_id integer, test_points integer, test_time integer); insert into results values (1,1,1), (1,3,2), (1,4,2), (2,1,5), (2,4,1), (2,4,0), (3,1,1), (3,2,2), (3,2,1); /* expected results : 2 4 0 1 4 2 3 2 1 */ select user_id, test_points, …

Member Avatar for smantscheff
0
121
Member Avatar for jazzyb
Member Avatar for drjohn
0
11K
Member Avatar for daviddoria

An XML (or object) database would be appropriate for highly hierarchical data which cannot be properly organized in tables. This might be the case if the objects have disparate and different attributes (fields) with little or no common subsets. Your data sample seems to be a quite ordinary sample for …

Member Avatar for d5e5
0
113
Member Avatar for ShArKsss

Join the tables on the field userid and use there WHERE search for the name only on the user table. [CODE]$sql = "mos_users.id as userid, block, username, email, lastvisitDate, firstname, lastname, avatar, cb_age, userip FROM mos_users, mos_comprofiler, mos_comprofiler_plug_iplog WHERE mos_users.username = '". $user."' AND mos_comprofiler.user_id = mos_users.userid AND mos_comprofiler_plug_iplog.userid = …

Member Avatar for ShArKsss
0
168
Member Avatar for vedro-compota

[CODE]select surname, subj_name, mark from student st left join exam_marks em on st.stud_id=em.stud_id join subject su on em.subj_id=em.subj_id [/CODE] If this does not fit your needs, please post a complete test case with table structure, test data, your query, the expected results and the actual results. Then it will become …

Member Avatar for vedro-compota
0
177
Member Avatar for xxmp

This seems to be not so trivial as it looks. You have to find not only some distance between two actors, but the minimum distance. This means that you have to scan all possible paths from actor1 to actor2, including the possibility that they are not connected at all. I …

Member Avatar for smantscheff
0
84
Member Avatar for professor123

To retrieve the values, use a SELECT query. Study the JOIN syntax ([url]http://dev.mysql.com/doc/refman/5.1/en/join.html[/url]) and give it at least a try before you ask for help. Come back when you cannot work it out. To create a table with those values, use the CREATE TABLE AS SELECT ... syntax ([url]http://dev.mysql.com/doc/refman/5.1/en/create-table.html[/url])

Member Avatar for jlego
0
83
Member Avatar for R0bb0b

Permanent settings are in Linux stored in /etc/mysql/my.cnf or /etc/my.cnf, depending on the distribution. On a Mac you probably won't find the file and you'll have to create it. See [url]http://forums.mysql.com/read.php?11,366143,376017#msg-376017[/url]

Member Avatar for R0bb0b
0
166
Member Avatar for EricIskhakov

This would be a task for a cron job. MySQL has date/time functions, so you could write a trigger which checks and updates a time value on every operation (update,insert,delete), but it would not do anything without such an operation. You could also code something like [CODE]select unix_timestamp('2012-01-01') - unix_timestamp(now()) …

Member Avatar for EricIskhakov
0
162
Member Avatar for sunwebsite

What means "optimum code" ? In number of code lines? In performance? In usability? Maybe I would try to solve this not in MySQL but in plain text format on a dump file with regular expressions (grep or, in PHP, preg). This could be the optimum in coding efficiency.

Member Avatar for smantscheff
0
1K
Member Avatar for vivi288

To be more precise, the trigger should not check how many but the maximum id value for cars of this brand and then add one.

Member Avatar for smantscheff
0
282
Member Avatar for xxmp

Convert your first procedure to a function which returns the desired value and call it from your 2nd procedure. Apart from that this looks like nonsense to me. What for do you need a stored procedure which does nothing than insert a row into a table?

Member Avatar for xxmp
0
149
Member Avatar for CanadianGSX

You cannot use the '+' operator for character strings in MySQL. Use the concat function instead. [CODE]$query = "SELECT partID, fname, lname FROM tblPartInfo WHERE lname LIKE concat('$lname','%') or fname LIKE concat('$fname','%')"; [/CODE]Or change your PHP code to [CODE]$query = "SELECT partID, fname, lname FROM tblPartInfo WHERE lname LIKE '$lname" …

Member Avatar for CanadianGSX
0
185
Member Avatar for leafscentral

The End.