Forum: MySQL 11 Days Ago |
| Replies: 2 Views: 310 I don't believe that you need a profile_id, just use the user_id as the key in the profiles table. When you create a new user, insert a record into both tables. When you delete a user's account,... |
Forum: MySQL 13 Days Ago |
| Replies: 1 Views: 327 You can simply pass the Count to the Max function like so:
select max(count(ProgramType)) as MAXCOUNT
from credential_state
group by ProgramType |
Forum: MySQL 14 Days Ago |
| Replies: 3 Views: 450 Ah ok, sorry I misunderstood what you were trying to do.
The SUBSTR() function might be able to help.
SELECT TARIFF FROM RATES WHERE COUNTRYCODE = SUBSTR(<phonenumber>, 0, 3)
You probably... |
Forum: MySQL 15 Days Ago |
| Replies: 3 Views: 450 Looks like COUNTRYCODE is a VARCHAR(3) (that is a maximum of 3 character string) so I don't think you can store the Bahamas code in that field. However if you want all country codes that start with a... |
Forum: MySQL 15 Days Ago |
| Replies: 2 Views: 404 In PHP the strtotime (http://au2.php.net/manual/en/function.strtotime.php) and date (http://au2.php.net/manual/en/function.date.php) functions might be useful to you. You can go:
for($i=0; $i<10;... |
Forum: MySQL Oct 23rd, 2009 |
| Replies: 2 Views: 666 You need to do this in two separate SQL queries. First, use a select statement to retrieve the location ID given the posted area. Then use this result as the location number when inserting to the... |
Forum: MySQL Oct 20th, 2009 |
| Replies: 1 Views: 372 Hi Vikk and welcome to DaniWeb :)
Have you made an attempt at this query yet? If you post what you have done we might be able to see what you are trying to accomplish and give some pointers. |
Forum: MySQL Oct 14th, 2009 |
| Replies: 1 Views: 357 Try this:
$query2 = "SELECT tblclasslist.studentNo FROM acumenchain.tblclasslist JOIN acumenchain.tblregistration ON tblclasslist.studentNo = tblregistration.studentNo JOIN acumenchain.tbllogin ON... |
Forum: MySQL Oct 12th, 2009 |
| Replies: 3 Views: 368 Not sure what DaniWeb's policy is, but for other forum-type sites that I have contributed to we kept all PM's, emails, forum posts in database tables. If the owner of the message deleted it (by... |
Forum: MySQL Sep 11th, 2009 |
| Replies: 3 Views: 437 Certainly it is important to liase with the end user in any project. If you are managing a database for accountants, then yes you will need to understand what they will use the database for and what... |
Forum: MySQL Jul 27th, 2009 |
| Replies: 2 Views: 433 The FIND_IN_SET function is used to search a list of strings for a specific string. I don't think you need to do this. Your query should look something like this I think:
$tag = $_GET[tag];
//... |
Forum: MySQL Apr 21st, 2009 |
| Replies: 5 Views: 1,059 Hi mr_vodka and welcome to DaniWeb :)
Love the username btw! :)
If all you want from the budget table is the budget_name field, you could just try this:
SELECT
fundinfo.fk_budget_ID,... |
Forum: MySQL Apr 14th, 2009 |
| Replies: 1 Views: 857 Hi inazrabuu and welcome to DaniWeb :)
You can nest SELECT statements in an INSERT statement to get you what you need. For example,
-- insert into which table the values
INSERT INTO A.t (id,... |
Forum: MySQL Apr 7th, 2009 |
| Replies: 3 Views: 985 Upsilon is very close with that query. I will extend to give you the minimum value:
SELECT min(value) as value FROM table_name HAVING count(value) = 1 |
Forum: MySQL Apr 3rd, 2009 |
| Replies: 7 Views: 714 > Sorry about this, I really am at a loss with all this.
No need to apologise, that's why this forum is here :)
The foreign key in table t1 is definately referencing itself. And the field in... |
Forum: MySQL Apr 3rd, 2009 |
| Replies: 7 Views: 714 Are you able to check the FK on that table? You can do this at the mysql prompt like so:
mysql > SHOW CREATE TABLE t1\G |
Forum: MySQL Apr 3rd, 2009 |
| Replies: 2 Views: 1,115 For primary key, try to insert a new record with the same PK as an existing record. If you can't, then the PK is working.
For a foreign key, try to insert a new record where the FK doesn't equal a... |
Forum: MySQL Apr 3rd, 2009 |
| Replies: 7 Views: 714 So you are trying to insert to t1 and you get that error? I must admit I didn't think it was possible to have such a foreign key constraint as one that references itself. I think if that's the case... |
Forum: MySQL Apr 3rd, 2009 |
| Replies: 7 Views: 714 A foreign key constraint is used to stop you from inserting data into the table without a corresponding record existing in another table. The ID field in the table you are inserting into must match... |
Forum: MySQL Apr 2nd, 2009 |
| Replies: 1 Views: 274 Something like this should work:
SELECT a.id, a.prod_id1, b.description as desc1, a.prod_id2, c.description as desc2
FROM comp_items a
INNER JOIN products b ON a.prod_id1 = b.prod_id
INNER JOIN... |
Forum: MySQL Apr 1st, 2009 |
| Replies: 1 Views: 351 Try ORDER BY RAND() instead of NewID() |
Forum: MySQL Apr 1st, 2009 |
| Replies: 2 Views: 464 Change GROUP BY to ORDER BY in the second query. I think this will give you the result you are looking for. |
Forum: MySQL Mar 30th, 2009 |
| Replies: 4 Views: 300 The date_add function is only for PHP version 5.3 or greater. Since 5.3 is due for general release later this year, I assume frenchwr cannot access that function.
What you need to do is use the... |
Forum: MySQL Mar 29th, 2009 |
| Replies: 4 Views: 300 Hi frenchwr and welcome to DaniWeb :)
This link (http://dev.mysql.com/doc/refman/5.1/en/index.html) will be useful for you, it is the reference manual for MySQL 5.1.
Are you storing the... |
Forum: MySQL Mar 27th, 2009 |
| Replies: 9 Views: 442 Also, if you are receiving an SQL error, it may not necessarily be output to screen. Try this after you run your query:
if( $result == false )
{
echo mysql_error( $link );
}
Again, $link... |
Forum: MySQL Mar 27th, 2009 |
| Replies: 9 Views: 442 1. I believe that is the name of his database, not a type of field.
2. I believe in his first post he has listed the actual query. |
Forum: MySQL Mar 27th, 2009 |
| Replies: 9 Views: 442 Yes, the documentation does seem to imply that. Maybe just try it to make sure?
This is certainly very strange. Maybe try explicitly stating the connection when you call mysql_query, like so:
... |
Forum: MySQL Mar 27th, 2009 |
| Replies: 9 Views: 442 Hi cvarcher / Rick and welcome to DaniWeb :)
All of your code looks ok to me, so I am going to ask a few obvious questions:
Firstly, is there a record in the jos_membership table with the... |
Forum: MySQL Mar 25th, 2009 |
| Replies: 2 Views: 945 Are period and month the same thing? What do you define as a working day? Are you wanting to only use MySQL to do this or are you combining with another programming language such as PHP? |
Forum: MySQL Mar 25th, 2009 |
| Replies: 6 Views: 709 But if the data is imported into the first two tables, I don't think you need the third table. Table 2 has the information that you require in Table 3, so you would just be duplicating data. |
Forum: MySQL Mar 23rd, 2009 |
| Replies: 6 Views: 709 By "imported" do you mean that they are in a different database? Is the database on another MySQL server? |
Forum: MySQL Mar 21st, 2009 |
| Replies: 2 Views: 462 This looks to be more of a PHP question than a MySQL question, but I think I can help. I would assign the results to variables in php and then simply add them. Like so:
$w = $row_standings['w'];... |
Forum: MySQL Mar 21st, 2009 |
| Replies: 6 Views: 709 Hi srpa01red and welcome to DaniWeb,
This is certainly doable. But I have to ask, if the third table only contains those two fields, is it necessary to create the third table? From the looks of... |
Forum: MySQL Mar 19th, 2009 |
| Replies: 1 Views: 603 I think in this situation you are better off explicitly joining the tables by account id. Like so:
SELECT COUNT(J.account) from JanTable J
INNER JOIN FebTable F
ON J.account = F.account
WHERE... |
Forum: MySQL Mar 15th, 2009 |
| Replies: 4 Views: 613 Ah yes, I do see the difference, but I think that your second select should be on prodid not id? |
Forum: MySQL Mar 15th, 2009 |
| Replies: 4 Views: 613 Hi praskuma and welcome to DaniWeb :)
-- First, what info do you need?
-- I have assumed just the title and description fields are what you want returned from this query
SELECT Title,... |
Forum: MySQL Mar 15th, 2009 |
| Replies: 2 Views: 793 Hi watchinthegame and welcome to DaniWeb :)
This is a bit odd. Can you please post your SQL query that you are using to update the record so we can take a look?
Cheers
d |
Forum: MySQL Mar 13th, 2009 |
| Replies: 4 Views: 851 So you will need to join the tables like so:
SELECT resortloc, resortname FROM table1
INNER JOIN table2 ON table1.resortid = table2.resortid
WHERE table1.resortloc = (SELECT MAX(resortloc) FROM... |
Forum: MySQL Mar 13th, 2009 |
| Replies: 3 Views: 592 Ok, do you want to update the existing record (and if so, what is the ID of that record) or insert a new record with the combined data of the other two (what are their ID's)? |
Forum: MySQL Dec 29th, 2008 |
| Replies: 1 Views: 703 Using your example, the following query should work:
-- get the required columns using aliases where necessary
SELECT e.id AS entry_id, sf.id AS sections_fields_id, sf.name AS value
-- from the... |