Sponsored Content
Top Forums Shell Programming and Scripting UPDATE COmmand post comparing 2 columns in 2 mysql tables Post 302946634 by siya@ on Wednesday 10th of June 2015 11:37:58 PM
Old 06-11-2015
So I used this to find the entries:
Code:
select distinct m.name, item_count, item from master m join client p on m.name=p.name where item_count = 1 and item > 1;

But how should I update them?

Code:
Update from client Set item =1  where m.name=p.name and item_count=1 AND item>1

Is this wrong?
Moderator's Comments:
Mod Comment Typing the string Code: in front of some text is not the same as putting some text in CODE tags as in: [CODE]some text[/CODE]. Please use CODE tags when displaying sample input, sample output, and sample code segments.

Last edited by siya@; 06-19-2015 at 04:20 AM.. Reason: Add CODE tags,
 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting tables of row data into columns of tables

I am trying to transpose tables listed in the format into format. Any help would be greatly appreciated. Input: test_data_1 1 2 90% 4 3 91% 5 4 90% 6 5 90% 9 6 90% test_data_2 3 5 92% 5 4 92% 7 3 93% 9 2 92% 1 1 92% ... Output:... (7 Replies)
Discussion started by: justthisguy
7 Replies

2. Shell Programming and Scripting

comparing two tables

I am comparing two table structure in different databases,Put into 2 txt files , when comparing if column sequnce and data type is not matching ,it has to display that info else Table structure is ok. wrote shell script ,its not working .I am getting "Table structure is not ok" even if both... (1 Reply)
Discussion started by: akil
1 Replies

3. Shell Programming and Scripting

Shell script for comparing data of tables

Hi, I have two databases with same tables on different servers.I need to check the data content in each table and if something is missing, should print that. I have a tool which takes the snapshot the table structure,index so on and compares with the other server tables snapshot. Now i need... (1 Reply)
Discussion started by: nessj
1 Replies

4. Web Development

mysql query for multiple columns from multiple tables in a DB

Say I have two tables like below.. status HId sName dName StartTime EndTime 1 E E 9:10 10:10 2 E F 9:15 10:15 3 G H 9:17 10:00 logic Id devName capacity free Line 1 E 123 34 1 2 E 345 ... (3 Replies)
Discussion started by: ilan
3 Replies

5. Programming

MySQL join four tables!

Hello; I want merge four MySQL tables to get the intersection that have a common field for all of them. Join two tables is fine to me, but my this case is different from common situations and there are not very many discussions about it. Can anybody give me some idea? Thanks a lot! Here is part... (8 Replies)
Discussion started by: yifangt
8 Replies

6. Shell Programming and Scripting

Show only new and removed records by comparing to MySQL tables

Hello all; I have been really frustrated with finding the correct perl code (and MySql statements) to accomplish what I thought was straight forward...I have tested I don't know how many different codes\suggestions I found on the net without any success...but anyhow let me explain my plight and... (0 Replies)
Discussion started by: gvolpini
0 Replies

7. Shell Programming and Scripting

Comparing two tables

I have defined a set of global variables at the beginning of my script as below: #ideal values export ITEM1=SUCCESS export ITEM2=FAILURE export ITEM3=UNAVAILABLE export ITEM5=FAILURE export ITEM6=SUCCESS now I have a shell script function which returns a value in below format. ITEM1... (1 Reply)
Discussion started by: ctrld
1 Replies
menu_items(3CURSES)					     Curses Library Functions					       menu_items(3CURSES)

NAME
menu_items, set_menu_items, item_count - connect and disconnect items to and from menus SYNOPSIS
cc [ flag... ] file... -lmenu -lcurses [ library... ] #include <menu.h> int set_menu_items(MENU *menu, ITEM **items); ITEM **menu_items(MENU *menu); int item_count(MENU *menu); DESCRIPTION
set_menu_items() changes the item pointer array connected to menu to the item pointer array items.menu_items() returns a pointer to the item pointer array connected to menu.item_count() returns the number of items in menu. RETURN VALUES
menu_items() returns NULL on error. item_count() returns -1 on error. set_menu_items() returns one of the following: E_OK The routine returned successfully. E_SYSTEM_ERROR System error. E_BAD_ARGUMENT An incorrect argument was passed to the routine. E_POSTED The menu is already posted. E_CONNECTED One or more items are already connected to another menu. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
curses(3CURSES), menus(3CURSES), attributes(5) NOTES
The header <menu.h> automatically includes the headers <eti.h> and <curses.h>. SunOS 5.10 31 Dec 1996 menu_items(3CURSES)
All times are GMT -4. The time now is 11:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy