Sql help - Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Webmaster Tech > Databases - MySQL, SQL, Oracle, Access and others

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 02-03-2010, 05:30 AM   #1 (permalink)
Junior Member
 
sagem's Avatar
 
Join Date: Jan 2010
Posts: 8
Default Sql help

Sql help

This may be too complex to ask in this forum as I've never posted here before; Anyway,
Wanted to see if anyone could assist me as I have very basic SQL writing experience.
So i have a table in our database that is basically a user_history table with system time stamps anytime the user edits, saves, etc.
the id would be Incident, Case, Part_Sequence
I want to write a sql that selects and Incident, Case, Part_Sequence when a particular user has at least one "log" or time stamp on that Incident
So let's say my scenario is this:
Incident Case User_ID Time_Stamp
12345 1 ABC123 2/1/2010 13:54
12345 1 ABC123 2/1/2010 13:59
12345 1 ABC123 2/1/2010 14:09
12345 1 ZYX321 2/1/2010 14:19
12345 1 ZYX321 2/1/2010 14:20
12345 1 ZYX321 2/1/2010 14:24
12345 1 ZYX321 2/1/2010 14:25
12345 1 ZYX321 2/1/2010 14:26
12345 1 ZYX321 2/1/2010 15:00


I would want the SQL to return only the following
12345 1 ABC123 2/1/2010 14:09
12345 1 ZYX321 2/1/2010 14:19

here's what I have so far

SELECT H. incident || '-' || H.case, h.user_id,
H. Time_Stamp
FROM incident_user_history H
WHERE h.incident_number || '-' || h.case_number IN (
SELECT iuh.incident || '-' || iuh.case
FROM incident_user_history iuh
WHERE h.incident || '-' || h.case =
iuh.incident || '-' || iuh.case
AND iuh.user_id = 'ABC123'
GROUP BY iuh.incident || '-' || iuh.case
HAVING COUNT (*) >= 1)


any help ?
sagem is offline   Reply With Quote
Sponsored Links
Old 02-04-2010, 05:52 AM   #2 (permalink)
Junior Member
 
Join Date: Aug 2009
Posts: 2
Default Re: Sql help

To resolve this issue, don't try more and go for either recovery or repair the database. To repair or recover the MS SQL Database, you need a third party software that can scan your system hard drive and recovery your all missing files as tables, database, triggers, store procedures, etc. Actually MS SQL Sever saves all the files with *.mdf file extension. So, MDF Repair will be more suitable using a MDF Repair tool.
jimmyrayjit is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 07:11 PM.


Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2
Webmaster Forums
Web Hosting | Chicago Web Hosting | Web Hosting