Click here to Skip to main content
15,881,172 members
Home / Discussions / Database
   

Database

 
GeneralRe: how to make a duplicate database with new name in SQL Server 2008 Pin
nvarunkumar18-Jun-12 21:59
nvarunkumar18-Jun-12 21:59 
AnswerRe: how to make a duplicate database with new name in SQL Server 2008 Pin
Paul Conrad19-Jun-12 8:22
professionalPaul Conrad19-Jun-12 8:22 
GeneralRe: how to make a duplicate database with new name in SQL Server 2008 Pin
nvarunkumar19-Jun-12 21:31
nvarunkumar19-Jun-12 21:31 
QuestionIn SQL Server, how to generate table script as a single statement? Pin
dexterama14-Jun-12 3:24
professionaldexterama14-Jun-12 3:24 
AnswerRe: In SQL Server, how to generate table script as a single statement? Pin
PIEBALDconsult14-Jun-12 4:09
mvePIEBALDconsult14-Jun-12 4:09 
GeneralRe: In SQL Server, how to generate table script as a single statement? Pin
dexterama14-Jun-12 5:50
professionaldexterama14-Jun-12 5:50 
AnswerRe: In SQL Server, how to generate table script as a single statement? Pin
Mycroft Holmes15-Jun-12 13:38
professionalMycroft Holmes15-Jun-12 13:38 
Questioni want to do left join that should not return same multiple rows Pin
asifkhan114-Jun-12 1:45
asifkhan114-Jun-12 1:45 
hello to all .. i m beginner to mysql and php and i want to do the LEFT JOIN of three tables with data given below
CREATE TABLE IF NOT EXISTS `history` (
`history_id` int(5) NOT NULL AUTO_INCREMENT,
`upload_id` int(5) NOT NULL,
`user_id` int(5) NOT NULL,
`datetime` date NOT NULL,
`location` varchar(200) NOT NULL,
PRIMARY KEY (`history_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;

--
-- Dumping data for table `history`
--

INSERT INTO `history` (`history_id`, `upload_id`, `user_id`, `datetime`, `location`) VALUES
(1, 1, 5, '2012-01-03', 'home'),
(2, 2, 5, '2012-06-20', 'Office'),
(3, 3, 5, '2012-03-06', 'office'),
(4, 4, 5, '2012-06-05', 'Home');

-- --------------------------------------------------------

--
-- Table structure for table `uploads`
--

CREATE TABLE IF NOT EXISTS `uploads` (
`upload_id` int(5) NOT NULL AUTO_INCREMENT,
`user_id` int(5) NOT NULL,
`file_path` varchar(200) NOT NULL,
`picture_path` varchar(200) NOT NULL,
PRIMARY KEY (`upload_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;

--
-- Dumping data for table `uploads`
--

INSERT INTO `uploads` (`upload_id`, `user_id`, `file_path`, `picture_path`) VALUES
(1, 5, 'hope', 'star'),
(2, 5, 'sky', 'mountain'),
(3, 5, 'smoking', 'habbits'),
(4, 5, 'sleeping', 'walking');

-- --------------------------------------------------------

--
-- Table structure for table `user`
--

CREATE TABLE IF NOT EXISTS `user` (
`user_id` int(5) NOT NULL AUTO_INCREMENT,
`name` varchar(75) NOT NULL,
`address` varchar(200) NOT NULL,
PRIMARY KEY (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;

--
-- Dumping data for table `user`
--

INSERT INTO `user` (`user_id`, `name`, `address`) VALUES
(5, 'Asif', 'Bannu'),
(6, 'Safeer', 'Bannu'),
(7, 'Farhad', 'Peshawar'),
(8, 'Rashed', 'Peshawar'),
(9, 'Yasir', 'Quetta'),
(10, 'Muhib', 'Islamabad');

i m executing the query
SQL
SELECT DISTINCT US.name, US.address, UP.file_path, UP.picture_path, HS.location
FROM user US
LEFT JOIN uploads UP ON US.user_id = UP.user_id
LEFT JOIN history HS ON US.user_id =  HS.user_id,
uploads UD LEFT JOIN history HSI ON UD.upload_id = HSI.upload_id
WHERE US.user_id = 5
ORDER BY US.user_id


but i m getting multiple rows with same data.
plz help me out in this situation. thanks a lot
AnswerRe: i want to do left join that should not return same multiple rows Pin
DRKARTHIKRAJ14-Jun-12 2:32
DRKARTHIKRAJ14-Jun-12 2:32 
AnswerRe: i want to do left join that should not return same multiple rows Pin
asifkhan114-Jun-12 3:09
asifkhan114-Jun-12 3:09 
GeneralRe: i want to do left join that should not return same multiple rows Pin
DRKARTHIKRAJ15-Jun-12 1:53
DRKARTHIKRAJ15-Jun-12 1:53 
AnswerRe: i want to do left join that should not return same multiple rows Pin
Eddy Vluggen14-Jun-12 2:39
professionalEddy Vluggen14-Jun-12 2:39 
AnswerRe: i want to do left join that should not return same multiple rows Pin
Nolan Sunico14-Jun-12 5:03
Nolan Sunico14-Jun-12 5:03 
AnswerRe: i want to do left join that should not return same multiple rows Pin
Michael Potter15-Jun-12 10:43
Michael Potter15-Jun-12 10:43 
QuestionFinding "Missing" ID Numbers in Table (SQL Server 2005) Pin
Peter Bamuhigire13-Jun-12 7:25
Peter Bamuhigire13-Jun-12 7:25 
AnswerRe: Finding "Missing" ID Numbers in Table (SQL Server 2005) Pin
Mycroft Holmes13-Jun-12 14:45
professionalMycroft Holmes13-Jun-12 14:45 
AnswerRe: Finding "Missing" ID Numbers in Table (SQL Server 2005) Pin
Eddy Vluggen14-Jun-12 0:59
professionalEddy Vluggen14-Jun-12 0:59 
QuestionView might cause corruption? Pin
kmoorevs13-Jun-12 5:35
kmoorevs13-Jun-12 5:35 
AnswerRe: View might cause corruption? Pin
David Mujica13-Jun-12 5:56
David Mujica13-Jun-12 5:56 
AnswerRe: View might cause corruption? Pin
Pete O'Hanlon13-Jun-12 5:57
mvePete O'Hanlon13-Jun-12 5:57 
AnswerRe: View might cause corruption? Pin
Corporal Agarn13-Jun-12 5:57
professionalCorporal Agarn13-Jun-12 5:57 
AnswerRe: View might cause corruption? Pin
Mycroft Holmes13-Jun-12 14:52
professionalMycroft Holmes13-Jun-12 14:52 
GeneralRe: View might cause corruption? Pin
kmoorevs14-Jun-12 4:20
kmoorevs14-Jun-12 4:20 
QuestionMySQL Pin
klaydze12-Jun-12 21:54
klaydze12-Jun-12 21:54 
AnswerRe: MySQL Pin
Bernhard Hiller12-Jun-12 23:34
Bernhard Hiller12-Jun-12 23:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.