Hi,
i have the table like this,
+------+-------+-----+
| city | caste | cnt |
+------+-------+-----+
| 1 | 1 | 2 |
| 1 | 2 | 3 |
| 2 | 1 | 1 |
| 2 | 2 | 2 |
| 3 | 1 | 3 |
| 3 | 3 | 1 |
+------+-------+-----+
i want to select the top caste which is having the most cnt...
User Profile
Collapse
-
Need query.. help me any one...
-
Need query help... urgent plz....
Hi,
i have the table like this,
+------+------+------+
| uid | val | type |
+------+------+------+
| 1 | 500 | 1 |
| 1 | 500 | 2 |
| 2 | 500 | 1 |
| 2 | 100 | 2 |
| 3 | 100 | 2 |
| 4 | 500 | 1 |
+------+------+------+
here, type 1 = sales and type 2 = return
i want to select only the sales record for the users, without... -
Hi, es, your query syntax is worng to add the date. So try with the following query.
[code=mysql]
SELECT *
FROM viajes
WHERE
viajes.fecha BETWEEN orderdate AND DATE_ADD(orderd ate,INTERVAL rango DAY);[/code]
Here,
[php]rango = $_GET['rango']
orderdate = $_GET['orderdate'][/php]
So u can format the query as per the PHP concatination syntax.
For general, date add function... -
Hi,
yes, its correct. so that only we can try with the following query,
[code=mysql]select * from table1 where col_name like '%regulate%' AND col_name NOT like '%control%';[/code]
Regards,
S.Ashokkumar
Please enclose your posted code in [code] tags (See How to Ask a Question).
This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for...Leave a comment:
-
Hi,
Try with the following query,
[code=mysql]select * from table1 where col_name like '%regulate%' AND col_name NOT like '%control%';[/code]
Regards,
S.Ashokkumar
Please enclose your posted code in [code] tags (See How to Ask a Question).
This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting...Leave a comment:
-
Hi,
One more way is given below,[code=mysql]
select * from table1 where col_name like '%regulate%' AND col_name NOT like '%control%';[/code]
Regards,
S.Ashokkumar
Please enclose your posted code in [code] tags (See How to Ask a Question).
This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources,...Leave a comment:
-
Hi,
Your query syntax is wrong. So try with the following one.
Query:
[code=mysql]
select tbl1.*
from table1 tbl1
inner join tlb2 on tb1.primary_id_ col = tbl2.primary_id _col /* Table Self Join Condition */
where tbl1.col_name like '%regulate%' and
tbl2.col_name not like '%control%';[/code]
Regards,
S.Ashokkumar
Please enclose your posted code...Leave a comment:
-
Hi,
i think, u r trying to join the 2 table to get the data from the tables when the user id is available in both tables. But the above join syntax is wrong. Check with the following query, it will help for ur requirement.
[code=mysql]
SELECT usr.*
FROM users usr
INNER JOIN tsms ts ON usr.id = ts.uid
WHERE usr.id = <$_REQUEST[2]>;[/code]
Before try with the...Leave a comment:
-
Hi yasmine,
i think, you are using the GUI tool to view the data from the table...
is it right? while using the some GUI tool, may be we will get the message "BLOB....". like this... so check with some other GUI tool like SQLyog, etc.. or use command line environment in windows / linux. we will get the full data.
i think, BLOB - 1.0 KB is not a mysql error... its a GUI tool error....
...Leave a comment:
-
Hi,
You have mentioned the 2 tables a & b. can u able to give me the table structure of the b table with the field and datatype of the field.
Consider sid field is integer, If we group contact any integer values, we will get as string like '1,2,3,4,5'. so, we cant store the string value in the integer field. So while copy the table we must need to change the sid field value from integer to text/longtext/blob....Leave a comment:
-
Hi,
Yes, we can store the values as comma separated value. Following example explain you properly and its very simple to understand... i hope...
Example:
-- Create table
-- ============
mysql> create table content(content varchar(100),si d varchar(100));
Query OK, 0 rows affected (0.04 sec)
-- Insert the values to the table
-- =============== ===============...Leave a comment:
-
Hi,
To take the backup of mysql database table, you can use the following "mysqldump" command.....
Syntax:
mysqldump [options] [database_name] [table_name] > <file_store_pat h>;
Example:
mysqldump -u root --extended-insert test_db sample_table > /home/backup/table_backup.sq l
Regards,
S.AshokkumarLeave a comment:
-
Need Help - Memcache with mysql
hi...
How to handle memcache with Mysql trigger?
Reffer : http://mysqlblog.lenox way.net/index.php?/archives/3-MySQL-triggers-and-memcache.html
Regards,
S.Ashokkumar. -
Need Query help please...
hi...
i have the table like this,
Table Name : sample
Total Records : 500000 (Consider like this)
Sample Records:
----------------
id ------------ name
=============== =======
1 -------------- AAA
2 -------------- BBB
3 -------------- CCC
2 -------------- AAA
3 -------------- AAA
4 -------------- CCC
1 --------------... -
Need Query.. Help Please...
hi...
i have the table like this,
Table Name : sample
Total Records : 500000 (Consider like this)
Sample Records:
----------------
id ------------ name
=============== =======
1 -------------- AAA
2 -------------- BBB
3 -------------- CCC
2 -------------- AAA
3 -------------- AAA
4 -------------- CCC
1 --------------... -
Need Query... Urgent Please help....
hi...
i have the table like this,
Table Name : sample
Total Records : 500000 (Consider like this)
Sample Records:
...Code:id ------------ name ====================== 1 -------------- AAA 2 -------------- BBB 3 -------------- CCC 2 -------------- AAA 3 -------------- AAA 4 -------------- CCC 1 -------------- BBB
-
Mysql cluster - Index
hi...
What are all the types of index supports in Mysql cluster method?
Regards,
S.Ashokkumar. -
Fetching ID's that match multiple rows.
hi...
i have the table like this,
id --------- name
--------------------
1 ---------- xxx
1 ---------- yyy
2 ---------- xxx
3 ---------- xxx
3 ---------- yyy
4 ---------- yyy
5 ---------- zzz
consider, one id is in more than one name. But,
I need the output like
id --------- name
--------------------
1 ----------... -
hi...
for do this, u have to use the dynamic sql.
For example:
user input value is 456,465,123....
first build the query lie this
set @vquery = CONCAT("select * from test_table where table_col in(","456,465,1 23",")");
prepare stmt from @vquery;
execute stmt;
Regards,
S.Ashokkumar...Leave a comment:
-
hi...
If we use the replace function to replace the new line, it will repalce all the new lines in the string...i dont want to remove the new line between characters. i want to remove from left side and right side of the string only.
Regards,
S.Ashokkumar....Leave a comment:
No activity results to display
Show More
Leave a comment: