RE: Stuck on SQL Query
I wouldn't have built it like that. Would have had a third table user products ProdID | UserID | StepNo | 1 |2|3| 2 |3|2| Then from here you could easily select any combination of product, user and step. And it would be more flexible because you could add steps without having to add fields. If your stuck with that structure you could do: select * from product,user where (user.userid=Step1Id or user.userid=Step2Id or user.userid=Step3Id ) and user.userid=#var# -Original Message- From: Richard Ramos [mailto:[EMAIL PROTECTED]] Sent: 23 May 2001 19:54 To: CF-Talk Subject: Stuck on SQL Query BlankHello, I have dug myself into a bit of a rut. I have two tables that are organized as so. Production ProdID | Step1ID | Step2ID | Step3ID AUTO |2|3|4 |3|2|1 User UserID | UserName - 1 | Tom 2 | Bob 3 | Mary How can I set up my query to find information based off of the user? I understand I can have a many-to-one relation but isn't that based off of rows? This is just a sample of the Production table. I also will have dates for each step and need to contain the information based off of a time period selected. Any insight on how to do a query like this would be great. Thanks in advance. Richard Ramos Network Administrator Softitler Net, Inc. www.softitler.com [EMAIL PROTECTED] ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Stuck on SQL Query
I wouldn't have built it like that. Would have had a third table user products ProdID | UserID | StepNo | 1 |2|3| 2 |3|2| Then from here you could easily select any combination of product, user and step. And it would be more flexible because you could add steps without having to add fields. If your stuck with that structure you could do: select * from product,user where (user.userid=Step1Id or user.userid=Step2Id or user.userid=Step3Id ) and user.userid=#var# -Original Message- From: Richard Ramos [mailto:[EMAIL PROTECTED]] Sent: 23 May 2001 19:54 To: CF-Talk Subject: Stuck on SQL Query BlankHello, I have dug myself into a bit of a rut. I have two tables that are organized as so. Production ProdID | Step1ID | Step2ID | Step3ID AUTO |2|3|4 |3|2|1 User UserID | UserName - 1 | Tom 2 | Bob 3 | Mary How can I set up my query to find information based off of the user? I understand I can have a many-to-one relation but isn't that based off of rows? This is just a sample of the Production table. I also will have dates for each step and need to contain the information based off of a time period selected. Any insight on how to do a query like this would be great. Thanks in advance. Richard Ramos Network Administrator Softitler Net, Inc. www.softitler.com [EMAIL PROTECTED] ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists